remove comma from last line

后端 未结 3 1084
攒了一身酷
攒了一身酷 2020-12-19 04:26

How do I remove the comma from the last line of the file? Here is the file:

# cat ox_data_archive_r_20120727.json
{\"name\": \"secondary_ua\",\"type\":\"STRI         


        
3条回答
  •  佛祖请我去吃肉
    2020-12-19 04:34

    This should work:

    sed '$ s/,$//g' input_file
    
    • The first $ selects the last line.

    You could add -i and sed will apply the changes to your input_file.

提交回复
热议问题