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
print all even lines of a txt file ajp7701 Shell Programming and Scripting 1 04-17-2008 11:17 PM
How to print only lines in between two strings using awk jisha Shell Programming and Scripting 4 01-11-2008 04:13 AM
How to print specific lines with awk Bugenhagen Shell Programming and Scripting 10 08-16-2007 06:41 AM
How to print number of lines with awk ? maheshsri Shell Programming and Scripting 1 11-18-2005 02:19 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-29-2002
apalex apalex is offline
Registered User
  
 

Join Date: May 2001
Location: NY
Posts: 39
print adjacent lines

how do you print the lines before and after the line you are interested in? Example: Line to be printed: line 344

Output:
line 343
line 344
line 345

Thanks
  #2 (permalink)  
Old 04-29-2002
apalex apalex is offline
Registered User
  
 

Join Date: May 2001
Location: NY
Posts: 39
i have this on my printline script. i'm just wondering if there's a better way...

# printline 344

b=`expr $1 - 1`
a=`expr $1 + 1`
sed -n ''$b','$a'p' file > newfile
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 06:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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