For example, assume we have a file a.txt:
line 1 line 2
I want to have,
pre line 1 pre line 2
sed -e 's/^/pre /'
$ echo "line 1 line 2" | sed -e 's/^/pre /' pre line 1 pre line 2
You may also do prefix adding to lines of certain patterns. But this is out of this question.