LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 03-07-2003, 01:10 AM   #1
born4linux
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?

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

Rep: Reputation: 46
Use awk.

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


Reply


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


All times are GMT -5. The time now is 07:23 AM.

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