![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| see a specific line in file | zivsegal | UNIX for Dummies Questions & Answers | 7 | 04-23-2009 07:08 PM |
| Printing a specific line using AWK | jake_won | Shell Programming and Scripting | 2 | 07-17-2008 11:53 AM |
| Re-write first line of a file before printing | alexop | Shell Programming and Scripting | 2 | 05-06-2008 08:36 AM |
| Printing a Line from a file | Nysif Steve | UNIX for Dummies Questions & Answers | 4 | 08-31-2007 07:58 AM |
| printing a line of a file | clay | UNIX for Dummies Questions & Answers | 6 | 12-15-2000 05:24 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
printing specific line from a file.
The below line gives the perfect output when I mention the record number and file name as hardcoded.
Code:
awk 'NR==3{print}' samp2.txt
Code:
row_num=3;file2=samp2.txt;awk 'NR==$row_num {print}' $file2
|
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|