sed - Append Line Bash File -
one liner in bash (for example using sed
) append line before last line in file.
example
old file
foo bar foo bar foo bar foo bar
new file
foo bar foo bar foo bar --new foo bar foo bar
i tried sed
on osx that
sed '$ --new foo bar' file.sh
i error command expects \ followed text
. ideas?
while versions of sed (e.g. gnu sed) support i
command on same line text inserted, posix standard specifies usage this:
sed '$i\ --new foo bar' file.sh
that is, i
followed backslash , newline, text inserted.
Comments
Post a Comment