shell - escape character "\" not working in awk with $ -
below sample data:
"udbpem1 "."histogrambin_@@@@@002__udbdi02$" "udbpem1 "."histogrambin_@@@@@002__udbdi02$"
place in tt file, want replace "histogrambin_@@@@@002__udbdi02$" "histogrambin_@@@@@002__udbdi02$_mig"
i using below below awk command substitution not happening.
awk '/histogrambin_@@@@@002__udbdi02\$/ {sub("'histogrambin_@@@@@002__udbdi02\$'","'histogrambin_@@@@@002__udbdi02\$_mig'")} {print}' tt
please let me know wrong command.
thanks, rakesh
adding further information:
the awk command here used replace object name picked file. $ can anywhere in name, want _mig @ end. actual awk command use in script below:
awk '/"'${tab_name}'"/{if (m==""){sub("'${tab_name}'","'${tab_name}_${tab_ext}'");m=1}}{print}' filename
i have use "" expand awk use shell variables , want replace first occurrence.
thanks, rakesh
in awk line, quotes not correctly used. do
awk '{sub(/h....\$/, "replacement")}7' file
Comments
Post a Comment