Skip to main content
added 36 characters in body
Source Link
RomanPerekhrest
  • 30.8k
  • 5
  • 47
  • 68

I don't think it's possible with echo command, use the following sed approach instead:

sed -i '$ s/$/abc/' file.txt
  • -i - modify the file inplace
  • $ - indicate the last record/line
  • s/$/abc/ - substitute the end of the line $ with substring abc (for the last record)

I don't think it's possible with echo command, use the following sed approach instead:

sed -i '$ s/$/abc/' file.txt
  • $ - indicate the last record/line
  • s/$/abc/ - substitute the end of the line $ with substring abc (for the last record)

I don't think it's possible with echo command, use the following sed approach instead:

sed -i '$ s/$/abc/' file.txt
  • -i - modify the file inplace
  • $ - indicate the last record/line
  • s/$/abc/ - substitute the end of the line $ with substring abc (for the last record)
added 3 characters in body
Source Link
RomanPerekhrest
  • 30.8k
  • 5
  • 47
  • 68

I don't think it's possible with echo command, use the following sed approach instead:

sed -i '$ s/$/abc/' file.txt
  • $ - indicate the last record/line
  • s/$/abc/ - substitute the end of the stringline $ with substring abc (for the last record)

I don't think it's possible with echo command, use the following sed approach instead:

sed -i '$ s/$/abc/' file.txt
  • $ - indicate the last record
  • s/$/abc/ - substitute the end of the string $ with substring abc (for the last record)

I don't think it's possible with echo command, use the following sed approach instead:

sed -i '$ s/$/abc/' file.txt
  • $ - indicate the last record/line
  • s/$/abc/ - substitute the end of the line $ with substring abc (for the last record)
Source Link
RomanPerekhrest
  • 30.8k
  • 5
  • 47
  • 68

I don't think it's possible with echo command, use the following sed approach instead:

sed -i '$ s/$/abc/' file.txt
  • $ - indicate the last record
  • s/$/abc/ - substitute the end of the string $ with substring abc (for the last record)