UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 20th, 2005, 05:00 AM
bilgeyts bilgeyts is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 5 bilgeyts User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 23 sec
Reputation Power: 0
Need a different command to display text files

hi,
i need a command to display text files.


How can i list the lines between 5 and 8?

$ XXXXXXXXXX what to write

thanks to jim macnamara

Reply With Quote
  #2  
Old October 20th, 2005, 09:54 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,308 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 5 h 20 m 49 sec
Reputation Power: 48
If you want the lines that occur physically in the file on lines 5,6,7,8
Code:
awk ' { if (NR>4 && NR < 9) print $0} ' filename


If the data has literally got the number 5 or 6 etc. in the second column
Code:
awk ' { if ($2>4 && $2 < 9) print $0} ' filename

Reply With Quote
  #3  
Old October 26th, 2005, 03:26 AM
time_out time_out is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 4 time_out User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 42 m 59 sec
Reputation Power: 0
Quote:
Originally Posted by jim mcnamara
If you want the lines that occur physically in the file on lines 5,6,7,8
Code:
awk ' { if (NR>4 && NR < 9) print $0} ' filename


If the data has literally got the number 5 or 6 etc. in the second column
Code:
awk ' { if ($2>4 && $2 < 9) print $0} ' filename


also can use
Code:
 head -8 <filename> | tail -4 

efficient only for small file

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Need a different command to display text files


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT