linux 中实现将 每一行指定的最后一个出现的特定字符替换为指定字符
001、
[root@pc1 test2]# ls a.txt [root@pc1 test2]# cat a.txt ## 测试数据 ab cd kk jj ee rr tt tt ss nn bb rr [root@pc1 test2]# rev a.txt | sed 's/ /_/' | rev ## 将最后一个空格替换为_. ab cd kk_jj ee rr tt_tt ss nn bb_rr

001、
[root@pc1 test2]# ls a.txt [root@pc1 test2]# cat a.txt ## 测试数据 ab cd kk jj ee rr tt tt ss nn bb rr [root@pc1 test2]# rev a.txt | sed 's/ /_/' | rev ## 将最后一个空格替换为_. ab cd kk_jj ee rr tt_tt ss nn bb_rr
