For Programmers: Free Programming Magazines  


Home > Archive > AWK > November 2004 > write all (int)$2 following lines into an output file when $1 equals /PATTERN/









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author write all (int)$2 following lines into an output file when $1 equals /PATTERN/
michael

2004-11-19, 8:55 am

hi,
it would be great if someone helps me:
The task is best described with a real life example:

inputfile:
"
irrelevant line cdecdddd
irrelevant line cewwercv
PATTERN 3
outputline 1
outputline 2
outputline 3
PATTERN
irrelevant line ffff
irrelevant line cde
irrelevant line ce
"

outputfile:
"
PATTERN 3
outputline 1
outputline 2
outputline 3
PATTERN
"
thanks in advance !
Stepan Kasal

2004-11-19, 8:55 am

Hi,

In article <1b5c0c3e.0411190013.4f1d5784@posting.google.com>, michael wrote:
> The task is best described with a real life example:


awk '/PATTERN 3/,/PATTERN/'

should do what you need.

Stepan Kasal
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com