file.log:
This is a firstfile.c.txt: 234
This is a secondfile.cpp.txt: 456
welcome to scriptfile.h.txt: 999
输出:
This is a firstfile.c: 234
This is a secondfile.cpp: 456
welcome to scriptfile.h: 999
有人可以帮我从输入文件中删除.txt
并显示上面的输出吗?
答案 0 :(得分:0)
cat file.log | sed 's/\.txt:/:/'
或
sed 's/\.txt:/:/' file.log