LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-22-2008, 01:07 PM   #1
finder255
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Rep: Reputation: 0
Smile search for a string spread in multiple lines


Hi,

I have to look for the full string below in a large file(>5GB) , but that string may be spread in two lines.

string :-- "f8f8 f5f0 f0f0 f1f7 f4f7 f7c1"

By grep "f8f8 f5f0 f0f0 f1f7 f4f7 f7c1" file | tail -1
, I am getting incorrect result because there is a line after this also which contains same string in two lines which does not get caught above ..

Please help..

Finder..
 
Old 10-22-2008, 02:06 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
This--and your other post---looks like homework. Please give us some context to help understand what the overall problem is.
 
Old 10-22-2008, 03:16 PM   #3
finder255
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Original Poster
Rep: Reputation: 0
yeah , I just figured out the way ...

I am actually writing a script for ebcdic to ascii conversion , followed by cutting of header and trailer together with record itself, buried in between, when sizes of file go beyond 2GB

Using sed, I am able to do it ...

sed -n '
/f8f8/{
N
s/f8f8 *\n*f5f0 *\n*f0f0 *\n*f1f7 *\n*f4f6 *\n*f7c1//
p
}' file | tail -1


Thx..

Last edited by finder255; 10-23-2008 at 08:38 AM.
 
  


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
Can you make search ...search a string in a link....a url...a web address aus9 LQ Suggestions & Feedback 4 04-16-2008 09:37 AM
Shell Script: Delete lines til string found or until particular string. bhargav_crd Linux - General 3 12-20-2007 11:14 PM
AWK/SED Multiple pattern matching over multiple lines issue GigerMalmensteen Programming 15 12-03-2006 05:08 PM
LXer: Time to spread Spread Firefox's message LXer Syndicated Linux News 0 02-01-2006 09:46 PM
Divide up lines with string delimiter elmu Programming 3 10-07-2005 08:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:48 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration