Error in replacing special chars using awk
I have a file with following data :
a$cd e%gh I am trying to replace the special chars with space. When I execute the following command these chars are replaced : awk '{gsub(/[\041-\177]/,"b",$0);print $0}' temp.txt Result: abcd ebgh But when I execute awk '{gsub(/[\041-\175]/,"b",$0);print $0}' temp.txt Result: a$cd e%gh these chars are not replaced.Could someone tell me if I am doing any mistake. Thanks in advance |
I have to investigate the reason of this strange behaviour more in depth, but in the meanwhile why don't use
Code:
gawk '{gsub(/[[:punct:]]/," ",$0); print}' temp.txt |
Thanks,your solution worked.
If you find the reason for the strange behaviour please let me know. |
All times are GMT -5. The time now is 02:21 PM. |