v2eeeeee
V2EX  ›  Z shell

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

  •  
  •   v2eeeeee · Mar 19, 2020 · 6331 views
    This topic created in 2428 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
    taolu
    Mar 19, 2020 via iPhone❤️1
    1
    fold -w64 file1 | tee file1
    aloxaf
    aloxaf
    May 6, 2020
    2
    fold -w64 file1 | sponge file1

    sponge 来自 moreutils
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4835 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 03:32 · PVG 11:32 · LAX 19:32 · JFK 22:32
    ♥ Do have faith in what you're doing.