Shell script to append text to each file? Shell script to append text to each file? bash bash

Shell script to append text to each file?


Use append redirection.

for f in *.txtdo  cat footer >> "$f"done


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" >> $fdone


sed -i.bak "$ a $(<file_block_of_text)" *.txt