Append

From wikieduonline
Jump to navigation Jump to search

Append at the end of a file:

echo "your_line_to_append" >> your_file.txt

history -a

tee --append ~/.ssh/config << END
Host localhost
  ForwardAgent yes
END


Using sed

sed -i s/^/TEST_TO_APPEND_AT_BEGINNIG/ file.txt
Append a space at the beginning of lines:
sed s/^/" "/
sed -i s/$/TEST_TO_APPEND_AT_END/ file.txt

Related[edit]

See also[edit]

Advertising: