x****t 发帖数: 1729 | 1 【 以下文字转载自 Seattle 讨论区 】
发信人: xiwest (梦中人), 信区: Seattle
标 题: Ask a question about UNIX
发信站: BBS 未名空间站 (Tue Dec 2 15:46:21 2008)
I have a document A, the format like:
buick|11-1-2008| FASDFDS
buick|11-1-2008|GTHRJUYR
buick|11-2-208|THYJJHGMHG
buick|11-3-208|TJLOUOYIG
.....
I want to turn it to document B:
buick|11-1-2008|2
buick|11-2-2008|1
buick|11-3-2008|1
basically to keep the 1st and 2nd column, while count the lines of the 3rd
column. A is sort and uniq.
if I only use "wc -l", it would only | s*********e 发帖数: 97 | 2 use awk and "|" as seperator, check the 2nd column and count/write to 3rd
column in your output file. |
|