Quote:
Originally Posted by raghu123
Hi all
I have this file
sandy is a writer
writer is a poet
sandy is a poet
i want the O/P to be
sandy was a writer
writer is a sandy
sandy was a poet
MEANS, wherever "sandy" is there, I want 'is' to be replaced by 'was'
please help
|
you want to replace 'is' by was whenever it is
preceded by 'sandy' or writer.
you can do this with sed:
suppose the original file is input.txt
you can get a resulting file named output.txt by:
# sed 's/\(sandy \|writer \)is /\1was /g' input.txt > output.txt