Replace usage of readlines()

Change-Id: Ic4c0af29f900b274b1a4b45d2e55f0012107d47c