I want to extract a substring between some given word and the end of the file, but I'm out of luck.
This is what my file looks like
non important line a
non important line b
...
...
...
non important line n
keyword
a,b,c,d
e,f,g,h
i,j,k,l
I want to match the keyword with the end of the file:
keyword
a,b,c,d
e,f,g,h
i,j,k,l
I tried this to replace the keyword only with foo, and not everything from the keyword to the end of the file:
cat foo | perl -pi -e 's/keyword.*\Z/foo/g'
Thanks!
source
share