Go to ...

Techpository

A Better Technical Repository

RSS Feed

Linux: Adding a prefix or space to each line of a file


Using sed you can easily add a prefix for each line of a file.
This is a quick command line way to format your text

sed -i -e ‘s/^/prefix/’ filename.txt

The following will add a space infront of each line
sed -i -e ‘s/^/ /’ filename.txt