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!

search & action 1

Status
Not open for further replies.

bader228

Technical User
Apr 1, 2002
1
BH
i want to search for a string but the action "print" will take effect on a different line?
 
Hi,

Can you say us more about what you want to do ?

The following script is just an example of a script that print the third line after each line containing the string "KEYWORD" :

/KEYWORD/ {
ToPrint[NR+3]=1;
}
{
if (NR in ToPrint) {
print $0
delete ToPrint[NR]
}
}
Jean Pierre.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top