I'm trying to figure out how to insert text before and after every line in a text file using sed
on OS X, but something is obviously wrong with my approach.
This is what I have:
sed 's/\(^\).\($\)/A \1\2 Z/g' input
This is what I want:
input:
bbb
ccc
ddd
output:
A bbb Z
A ccc Z
A ddd Z
EDIT: Also, don't match blank lines (or those containing only spaces).