Replacing \ with "" gives ^ unterminated string
I am trying to run my custom script on a set of grep results using the command
Code:
<custom script> | grep ^search_query: | awk '{print $NF}' xyz:test\[Soluta incorrupte id\] I need to get rid of \ character before I run my script (I am guessing they were added as escape characters) So I modified my call as Code:
<custom_script> | grep ^search_query: | awk 'gsub("\","");{print $NF}' awk: gsub("\","");{print $NF} awk: ^ unterminated string I tried a few other things using sed, but could not make it work. Any suggestion? Thanks much to all |
Perhaps?
Code:
<custom_script> | grep ^search_query: | tr -d '\\' |
That worked....thanks much
|
Use
Code:
awk '{gsub(/\\/,"")}1' Code:
<custom_script> | grep ^search_query: | awk '{gsub(/\\/,"")}1' Code:
echo "xyz:test\[Soluta incorrupte id\]" | awk '{gsub(/\\/,"")}1' |
I do not like that grep|tr|awk -like chains, so:
<custom script> | awk '/^search_query:/ { gsub("\\\\",""); print $NF }' |
All times are GMT -5. The time now is 09:35 PM. |