wc -l command, only keeping the numbers
Hey everyone,
I am writing a small script which has to take the number of lines in a file, divide it by two, and store it as a variable: I first tried to store the number of lines in a file with: Code:
let MIDPOINT=`echo "wc -l $FILE"` |
Code:
cat $FILE | wc -l |
numlines=$(($(wc -l filename | cut -d " " -f 1 -)/2))
|
Or something like:
Code:
MIDPOINT=$(awk 'END{print NR/2}' $FILE) |
Code:
let MIDPOINT=`echo "wc -l < $FILE"` |
Thanks everyone.
|
All times are GMT -5. The time now is 05:17 AM. |