Why doesn't “sort file1 > file1” work?

前端 未结 7 1454
忘了有多久
忘了有多久 2020-12-03 21:23

When I am trying to sort a file and save the sorted output in itself, like this

sort file1 > file1;

the contents of the file1 is getting

相关标签:
7条回答
  • 2020-12-03 22:04

    You can use this method

    sort file1 -o file1
    

    This will sort and store back to the original file. Also, you can use this command to remove duplicated line:

    sort -u file1 -o file1
    
    0 讨论(0)
提交回复
热议问题