使用 awk 或 sed 删除特定字符 [英] Remove a specific character using awk or sed
本文介绍了使用 awk 或 sed 删除特定字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个命令输出,我想从中删除双引号 "
.
I have a command output from which I want to remove the double quotes "
.
命令:
strings -a libAddressDoctor5.so |
grep EngineVersion |
awk '{if(NR==2)print}' |
awk '{print$2}'
输出:
EngineVersion="5.2.5.624"
我想知道如何使用 awk
或 sed
删除不需要的字符.
I'd like to know how to remove unwanted characters with awk
or sed
.
推荐答案
使用 sed 的替换:sed 's/"//g'
Use sed's substitution: sed 's/"//g'
s/X/Y/
用 Y 替换 X.
g
意味着所有出现的都应该被替换,而不仅仅是第一个.
g
means all occurrences should be replaced, not just the first one.
这篇关于使用 awk 或 sed 删除特定字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文