bash - sed command to add text for only last line in unix -


I think the sed command will only add a comma to the last line. Example I have a text file with

  "87270 9" "872808" "872808b" "8729029 921" "879b" "87290" "Airhome 9" "22" "DDSP 2222" "G929"   

Add a comma on the last line

  "87270 9" "872700" "145" "872808b" "8729029 921" "879b" "87290" "Airho 9" "at 22" "DVDSPP22" "G992",    

You can use sed Are:

  sed '$ s / $ /, /' file "872709" "872700" "145" "872808b" "8729029 921" "879b" "87290" "Aeroho 9 "" at 22 "" DVDSPP22 "" G992 ",   

To save changes to inline use:

  sed -i .bak '$ s / $ /, /' file    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -