gawk - Latin characters in AWK -


i have question latin-1 characters in awk, example ï (an 2 dots above (239)).

when replace ï in string created in awk (i replace 2 dots one), works:

a="aïda" a=gensub("ï","i","g",a) 

but when do,

awk ' {     $0=gensub("ï","i","g",$0) }' \   <(cat units.csv) 

where string "aïda" in file units.csv, ï not substituted, apparently not in awk. don't understand. don't know how see is awk instead of ï.

thanks,

eric j.

  • awk won't write change original file (input), have output tmp file, in awk script, didn't output anything

  • the cat part not needed awk '..' file

  • gensub not necessary in case, gsub may work requirement. both work fine

see example:

kent$  cat file ï ï ï ï ï  kent$  awk '{$0=gensub("ï","x","g")}1' file  # (or awk '{print gensub("ï","x","g")}' file) x x x x x  kent$  awk 'gsub("ï","x")' file                                                                                                                                              x x x x x 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -