- wc -l *.csv (This command will count rows per csv file)
- #!/bin/bash
rows=0;
for f in `*.CSV`;
do
let rows+=`wc $f | awk '{print $1}'`
done
echo "Total rows=$rows"
Thursday, October 28, 2010
Command to calculate number of rows in a file
Sometimes there are so many files and you want to count number of rows in each file the a command or a shell script is handy to get it done otherwise its almost impossible to count number of rows in file. Following are some ways to calculate this.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment