How to sort a file in-place

后端 未结 6 1822
青春惊慌失措
青春惊慌失措 2020-11-30 17:37

When we use sort file command, the file shows its contents in a sorted way what if I don\'t want to get any-kind of output but a sorted file?

6条回答
  •  醉梦人生
    2020-11-30 18:34

    sort file | sponge file
    

    This is in the following Fedora package:

    moreutils : Additional unix utilities
    Repo        : fedora
    Matched from:
    Filename    : /usr/bin/sponge
    

提交回复
热议问题