anarchystar
05-16-2009, 05:45 PM
Hey, looking for a little help with a linux shell script I am writing since I am not very good at it.
I need to count the number of lines in the files of a specified directory and return the ONLY the file with the most lines.
I can accomplish the first task with 'wc -l *|sort -rn'
that will return the line count of all the files in the working directory and order them from highest to lowest. What I cannot figure out is how to only return the file with the most lines and exclude all the others.
I need to count the number of lines in the files of a specified directory and return the ONLY the file with the most lines.
I can accomplish the first task with 'wc -l *|sort -rn'
that will return the line count of all the files in the working directory and order them from highest to lowest. What I cannot figure out is how to only return the file with the most lines and exclude all the others.