bash - linux command line text file manipulation -
let's have text file following contents:
test blablabla test1 moreblabla atest blabla3 just*a*test blabla14 test88 lastblabla
i want delete only line matches string "test" , line after without deleting lines contain string "test" in case want delete first , second lines not rest.
the above file example, contents of file varies string.
all examples found sed
deal deleting lines contain string. want delete line is string.
just add ^
, $
around test
regex anchor match.
sed -e '/^test$/,+1d' path/to/file
or ^ *test *$
line containing 'test' possibly spaces.
Comments
Post a Comment