LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   grepping for multi-line output (https://www.linuxquestions.org/questions/programming-9/grepping-for-multi-line-output-48674/)

born4linux 03-07-2003 01:10 AM

grepping for multi-line output
 
i can't get any reference about this online nor with the man page, so I need some tips here.

my situation;

- i have a file which contains plain text records with each record consisting of 1 to 4 lines. how do i grep (or whatever tool) the record number and print all the lines related to that record? each record is separated by lines made up of dashes. ie:

------------------------------------------------------------
yyyymmdd blahsdfdf dkfdkflasjfljdflj recordnum
blah blah blah
blah blah blah yada yada
------------------------------------------------------------

i might be using the wrong tool (grep and awk) or what?

thanks.

moses 03-07-2003 02:26 AM

Use awk.

http://www.linuxquestions.org/questi...threadid=41050


All times are GMT -5. The time now is 12:16 AM.