The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
command for selecting specific lines from a script gardasgangadhar UNIX for Dummies Questions & Answers 1 05-13-2008 05:29 AM
Urgent: selecting unique specific content of a file using shell script jisha Shell Programming and Scripting 2 01-08-2008 08:45 AM
replacing specific lines in a file hcclnoodles Shell Programming and Scripting 6 09-30-2006 11:35 AM
remove specific lines from a file hcclnoodles Shell Programming and Scripting 14 09-07-2006 12:31 PM
How do you specific lines in a file? hedgehog001 UNIX for Dummies Questions & Answers 2 08-23-2005 12:04 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-05-2008
tansha tansha is offline
Registered User
  
 

Join Date: May 2006
Posts: 23
Help with selecting specific lines in a large file

Hello,

I need to select the 3 lines above as well as below a search string, including the search string.

I have been trying various combinations using sed command without any success.

Can anuone help please.

Thanking
  #2 (permalink)  
Old 02-05-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,859
If you can use grep instead of sed the grep options -A -B or -C should allow you to do what you want to do.
  #3 (permalink)  
Old 02-06-2008
tansha tansha is offline
Registered User
  
 

Join Date: May 2006
Posts: 23
Hello, Thanks for the reply.

But I don't think I can use grep as I don't know what are the data block in between teh search string.
My file layout is as follows:

------------------------------
Data
(numerous lines)
------------------------------
Data
(numerous lines)
------------------------------
Data
(numerous lines)
------------------------------
Data
(numerous lines)

And so on. I only need to get the 3 lines above and below the -----------
as well as the -------------

Thanks for any assistance

.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0