1

我有一个包含以下数据的文件。我想只考虑第二列的唯一数据。

May 23, 2013|380565195-00001
May 23, 2013|386277814-00001
May 15, 2013|370674334-00001
May 23, 2013|370674334-00001
May 23, 2013|422011458-00001
May 21, 2013|620734890-00001
May 23, 2013|721962541-00001
May 22, 2013|820591328-00001
May 23, 2013|820591328-00001
May 10, 2013|900544559-00099
May 23, 2013|900544559-00099
May 23, 2013|981242670-00001

输出应如下所示。

May 23, 2013|380565195-00001
May 23, 2013|386277814-00001
May 15, 2013|370674334-00001    
May 23, 2013|422011458-00001
May 21, 2013|620734890-00001
May 23, 2013|721962541-00001
May 22, 2013|820591328-00001
May 10, 2013|900544559-00099
May 23, 2013|981242670-00001

请帮助我。

4

1 回答 1

3
awk -F"|"  '{if (!h[$2]) {h[$2]=1; print;}}'
于 2013-07-22T08:03:37.260 回答