I'm having a file which contains following data1. verification: 10 passed 0 failed2. verification: 10 passed 0 failed3. verification: 10 passed 1 failed4. verification: 10 passed 3 failed5. verification: 10 passed 0 failedI want to know the line numbers of 3 and 4.
Extract line number of a file which is having a non zero value before a specified string
grep;string;numbering
Assuming the file is called in.txt, then:-awk '$5>0 {print $0; }' in.txtwill give you:-3. verification: 10 passed 1 failed4. verification: 10 passed 3 failedI've made the assumption the the line numbers (1-5) is part of the file.  If it isn't change the $5 to $4.If the line number is part of the file and you want to just print it without the dot:-awk '$5>0 {sub(/\./,,$1); print $1 }' in.txtwhich gives:-34