Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

skipping lines after pattern match

Status
Not open for further replies.

tafkid

Programmer
Dec 14, 2008
9
US
Hi I'm an awk newbie and I need help with a problem.
I have some files in which I need to match a certain pattern, skip two lines and then replace the current line (after skipping) with something e.g.
...
line a ("tom") <-- tom is the pattern to be found
line b blah blah <-- to be skipped
line c blah blah <-- to be skipped
line d ("finn") <-- replace finn with sawyer
...

Please note that there are lines before and after line a and d respectively. Also, I cannot go directly to finn since I do not know the value before hand (the double quotes are in the file). Any help is much appreciated.

 
What have you tried so far and where in your code are you stuck ?

BTW, where is "sawyer" coming from ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks feherke it worked like a charm after some modification.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top