Reputation: 2119
I have 300 files in a folder. I have to append one new line at the end of all files in a folder.
How can i achieve it using grep.
I tried the following command but its not working
sed 's/$/\n/' /Path/filename.txt
Upvotes: 12
Views: 13797
Reputation: 289835
Just say echo "" >> file
. This will append a new line at the end of file
.
To do it in all the files in the folder:
for file in *
do
echo "" >> "$file"
done
From the comments, in your case you have to say:
for file in /path/*.txt
do
echo "" >> "$file"
done
Upvotes: 25