I would like to find a solution to add some characters in a string
Example
folder/dir/directory/file.txt
shares/page.html
etc/downloads/torrent.torrent
Should become
.folder.old/dir/directory/file.txt
.shares.old/page.html
.etc.old/downloads/torrent.torrent
How can i do that? 'grep' would be a correct choose?
Thank you
Use sed instead of grep:
sed -i.bak 's#^\([^/]*\)#.\1.old#'
Note that -i will save the result in the original file itself. -i.bak will save your original file with .bak extension in case something goes wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With