Difference between revisions of "Append"
Jump to navigation
Jump to search
Line 10: | Line 10: | ||
− | Using <code>[[sed]]</code> | + | Using <code>[[Sed (editor)|sed]]</code> |
* [[Append]] a text (TEST_TO_APPEND_AT_BEGINNIG) at the [[beginning]] of a line: | * [[Append]] a text (TEST_TO_APPEND_AT_BEGINNIG) at the [[beginning]] of a line: | ||
:: <code>sed -i s/^/TEST_TO_APPEND_AT_BEGINNIG/ file.txt</code> | :: <code>sed -i s/^/TEST_TO_APPEND_AT_BEGINNIG/ file.txt</code> |
Revision as of 16:22, 14 February 2022
echo "your_line_to_append" >> your_file.txt
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 beggining of lines:
- Append a text (TEST_TO_APPEND_AT_END) at the end of a line (
$
):
sed -i s/$/TEST_TO_APPEND_AT_END/ file.txt
Related
See also
echo
,print, printf
,tput
,logger
,write-output, echo -e, /dev/stdout, banner
tee
,sponge
,append, prepend, tee --append
Advertising: