Answer» I've problem for counting rows of multiple text(.txt) file. How can i use command to get the row count. The test files is like this. txt file1 txt file2 a,1111 z,999 b,2222 y,888 c,3333 x,777 I've TRIED cmd wc -l FILENAME | awk '{print $1}' and the output is 3 3 6 if cmd like this wc -l filename (without awk), the output, 3 file1 3 file2 6 total How can i get only the total value (in above case '6')
Please help meYou're nearly there with wc and awk. Just throw tail into the mix and its done.
Code: [Select]wc -l *.txt | awk '{print $1}' | tail -1thanks..
but how about this ONE above...
$cat file.txt ... then the output
Name : razi Acc : 1111 Name : ana Acc : 2222 Name : John Acc : 3333
How can i select only the NAME ROW.
The output that i desire is
Name : Razi Name : Ana Name : John
Do assist me..thanks
There are 2 ways to SOLVE this.
Throw in another command
Code: [Select]grep '^Name :' *.txt | wc -l| awk '{print $1}' Or do the whole thing in awk
Code: [Select]awk 'BEGIN {total = 0}($1 == "Name"){total++} END {print total}' *.txt
|