Hi all,
I am having the below file log.txt
1 aaa 111 @@@
2 bbb 222 ###
14 ccc 333 $$$
using awk '$1!=1 || $1!=14 {print $1" " $2}' log.txt
gets the below output
1 aaa
2 bbb
14 ccc
any one can sort what the problem is ?
thanks in advance
era
2
You want "and", not "or". One condition or the other is true even if $1 is 1 or $1 is 14 (sic).
awk '$1!=1 && $1!=14 {print $1" " $2}' log.txt
how to sort this output in ascending order
Pipe the awk output to sort. Check the man page of sort.