aa bb cc dd ee
aa 34 cc 12 34
ee 34 44 55 66
.........
Now I have to follow the first and third columns statistics ( first and third columns if the same , leaving only one line ) , output of the first row and the first four , and the number of records , such as the above output :
aa cc 2
ee 44 1
beg you big God
------ Solution -------------------------------- ------------
accordance with your request output , where test is the documentation of your input data
$ cat test |awk '{print $1" "$3}' | uniq -c | awk '{print $2" "$3" "$1}' aa cc 2
ee 44 1
------ For reference only ---------------------------------- -----
$ cat test
aa bb cc dd ee
aa 34 cc 12 34
ee 34 44 55 66
$ cat test |awk '{print $1" "$3}' | uniq -c 2 aa cc
1 ee 44
number on the front
------ For reference only ---------------------------- -----------
thanks ah
没有评论:
发表评论