v2eeeeee
V2EX  ›  Z shell

大佬指点下 Linux 文件修改替换原文件的方法

  •  
  •   v2eeeeee · Mar 19, 2020 · 5876 views
    This topic created in 2262 days ago, the information mentioned may be changed or developed.

    fold -w64 file1 > tmp && mv tmp file1

    求问下这个命令有没有优雅的写法?修改替换掉原文件

    谢谢大佬指点大佬指点

    2 replies    2020-05-06 15:15:47 +08:00
    taolu
        1
    taolu  
       Mar 19, 2020 via iPhone   ❤️ 1
    fold -w64 file1 | tee file1
    aloxaf
        2
    aloxaf  
       May 6, 2020
    fold -w64 file1 | sponge file1

    sponge 来自 moreutils
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1026 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 18:41 · PVG 02:41 · LAX 11:41 · JFK 14:41
    ♥ Do have faith in what you're doing.