echo "abc" >>file.txt
.abc
after new lineabc
in the end of file with echo without new line?echo
command, use the following sed
approach instead:sed -i '$ s/$/abc/' file.txt
-i
- modify the file inplace$
- indicate the last record/lines/$/abc/
- substitute the end of the line $ with substring abc (for the last record)