Shell script to append text to each file?

后端 未结 5 883
抹茶落季
抹茶落季 2020-12-10 01:16

I have a folder full of text files. I need to append the same block of text to each of them (and of course overwrite the original file).

I was wondering what the co

5条回答
  •  一整个雨季
    2020-12-10 01:50

    very simply one which worked well for me

    #!/bin/sh
    FILES="./files/*"
    
    for f in $FILES
    do
        echo '0000000' | cat - $f > temp && mv temp $f
    done
    

提交回复
热议问题