Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-07-2003, 01:10 AM   #1
Senior Member
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
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?

Old 03-07-2003, 02:26 AM   #2
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 49
Use awk.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Command to output file content line by line aznluvsmc Programming 2 09-12-2004 07:45 PM
ssh lock up on multi line output Incanus Linux - Networking 0 07-20-2004 08:47 PM
grepping last word of output rajatgarg Programming 3 11-25-2003 10:41 AM
Sorting of multi-column output rytrom Linux - Newbie 11 09-15-2003 11:31 AM
multi send line m_m_zeus Linux - Networking 0 09-22-2002 05:19 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:28 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration