You can use wc to get the number of lines in a file (the option -l does this). Edit: you can also store the output of a command in a variable with syntax like this:
variable=`command`
For example, to put the number of lines in the file foo in a variable called num_lines, you'd use the following:
num_lines=`wc -l foo`
Last edited by Nylex; 07-26-2008 at 10:22 AM.
|