Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AWK script to print the first 50 lines of any text file?

Status
Not open for further replies.

philthygeezer

Technical User
Jan 15, 2009
3
US
I've got some whopping big text files to deal with, and would like to view partial contents in order to determine how to handle them.

Thanks,
P
 
awk 'FNR<=50' list_of_files

In *nix: man head

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I piped the command awk 'FNR<=50' hugefile.txt > junk2.txt

junk2.txt is created but it's empty.
 
Unfortunately, FNR is not portable across all versions of awk. If you run Solaris, use nawk.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top