![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding specific text and spaces to each line in a text file | hertingm | Shell Programming and Scripting | 4 | 08-25-2008 03:34 PM |
| how to replace one line in text with several lines | FunnyCats | UNIX for Dummies Questions & Answers | 1 | 01-18-2007 09:52 AM |
| how to print out line numbers of a text file? | forevercalz | Shell Programming and Scripting | 4 | 12-12-2005 05:04 AM |
| Print only certain lines from a text file | CamTu | Shell Programming and Scripting | 1 | 06-01-2005 12:47 PM |
| Search for text and print the next line | alijassim | Shell Programming and Scripting | 2 | 08-17-2004 07:08 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to print the lines after 2nd line from text file
Hi All,
I need to print the lines after 2nd line irrespective of the number of lines in file if the file contents are like below ---------- root:!:0:0::/root:/usr/bin/ksh daemon:!:1:1::/etc: bin:!:2:2::/bin: sys:!:3:3::/usr/sys: adm:!:4:4::/var/adm: uucp:!:5:5::/usr/lib/uucp: guest:!:100:100::/home/guest: nobody:!:4294967294:4294967294::/: lpd:!:9:4294967294::/: . . . I need from the line after "daemon" line like as below ----- bin:!:2:2::/bin: sys:!:3:3::/usr/sys: adm:!:4:4::/var/adm: uucp:!:5:5::/usr/lib/uucp: guest:!:100:100::/home/guest: nobody:!:4294967294:4294967294::/: lpd:!:9:4294967294::/: . . . |
|
||||
|
there are many ways to do this...
I normally use sed for this, sed -n '3,/ArbitWord/p' <inputFile> here ArbitWord is something which you can not expect to be present in your input file one other way is using tac tac <inputFile> | head --lines=-2 | tac |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|