V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
v2eeeeee
V2EX  ›  Z shell

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

  •  
  •   v2eeeeee · Mar 19, 2020 · 5802 views
    This topic created in 2237 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   ·   781 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 22:17 · PVG 06:17 · LAX 15:17 · JFK 18:17
    ♥ Do have faith in what you're doing.