Find number of lines in a file
Tagged with: command, count, file, lines, Linux, rows
Thursday, March 20th, 2008 11:30 PM
Find the number of lines in a file using this command…
cat -n file
OR
wc -l file
Find the number of lines in a file using this command…
cat -n file
OR
wc -l file
This will join all lines of a file together. Sometimes I have a list of something in a file, one line per item and want to convert it to a comma(colon,tab)-separated line (with no trailing separator of course) that can be used as a command-line parameter to some other tool.
perl -e '@_=; chomp(@_); print join(";",@_);' < data_file