I'm try counting the number of lines in a file which 4th field is greater than first filed by using awk command I came up with this command:
awk '$4>$1 {print}' sampleFile | wc -l
Is there any better way to find the number rather than using wc -l
One way using GNU awk
:
awk '$4 > $1 { count++ } END { print count }' file.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With