开发者

Shell Scripting: get unique items in a file

The question is based on the function uniq unless you h开发者_StackOverflow社区ave some other suggestion.

I have a file which has only one column with n number of rows, and contains redundant names of items randomly.

I have tried command uniq filename>filename2 to get the unique items in filename2... but it doesn't work. I still get the same list.

Any suggestions as to how I can tackle this problem?

Thank you in advance.


Try sort -u. uniq only filters out repeated lines, not duplicate lines spread out over the input.


Try sort -u filename > filename2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜