Shell script to append text to each file?

后端 未结 5 892
抹茶落季
抹茶落季 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:57

    If you're needing to do this via a script, you can use echo and append redirection to get the extra text into the files.

    FILES=pathto/*
    for f in $FILES ; do
        echo "#extra text" >> $f
    done
    

提交回复
热议问题