I have a command output from which I want to remove the double quotes "
.
Command:
strings -a libAddressDoctor5.so |\ grep EngineVersion |\ awk '{if(NR==2)print}' |\ awk '{print$2}'
Output:
EngineVersion="5.2.5.624"
I'd like to know how to remove unwanted characters with awk
or sed
.
tr can be more concise for removing characters than sed or awk , especially when you want to remove multiple different characters from a string. -d stands for "delete".
Remove Character from String Using trThe tr command (short for translate) is used to translate, squeeze, and delete characters from a string. You can also use tr to remove characters from a string. For demonstration purposes, we will use a sample string and then pipe it to the tr command.
Both sed and awk allow processing streams of characters for tasks such as text transformation. The awk is more powerful and robust than sed. It is similar to a programming language.
Use sed's substitution: sed 's/"//g'
s/X/Y/
replaces X with Y.
g
means all occurrences should be replaced, not just the first one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With