Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Awk Command not able to read French/Spanish characters from a file

Status
Not open for further replies.

V_M

Programmer
Jul 22, 2022
1
CA
Using Awk Commmand I am trying to get value of a column in .csv file which contains French/Spanish characters. When Viewing file through View command French/Spanish characters are printed properly but using awk/head command it removes French/Spanish . Sample Data - Vinêâêîôûcédille characters.

Awk Command Output - Vin▒▒▒▒▒▒c▒dille

Head Command output - "Vin▒▒▒▒▒▒c▒dille

Expected Output - Vinêâêîôûcédille

Please see code and output snippet below

view Package_UTF8.txt

"dE82WVJ","CmFX","COMPLETED","false","Vinêâêîôûcédille TEST","en","PACKAGE","2022-07-20T18:15:13Z","","Vinêâêîôûcédille","2022-07-20T18:16:04Z","true","Electronic Disclosures and Signatures Consent","false","default-consent","tO6YRDDweek5","Vi","Ma","","","vi.ma@xyz.com","null","en","","","tO6YRDDweek5","0","null","2022-06-23T17:04:10Z","2022-06-29T21:50:14Z","ACTIVE","REGULAR","false","Vi_Ma_tO6YRDDweek5_Vinêâêîôûcédille_20220720T181513Z"

awk -F "," 'NR==2 {print ($34) }' Package_UTF8.txt;

"Vi_Ma_tO6YRDDweek5_Vin▒▒▒▒▒▒c▒dille_20220720T181513Z"

'head -2 Package_UTF8.txt'

"dE82WVJ","CmFX","COMPLETED","false","Vin▒▒▒▒▒▒c▒dille TEST","en","PACKAGE","2022-07-20T18:15:13Z","","Vin▒▒▒▒▒▒c▒dille","2022-07-20T18:16:04Z","true","Electronic Disclosures and Signatures Consent","false","default-consent","tO6YRDDweek5","Vi","Ma","","","vi.ma@xyz.com","null","en","","","tO6YRDDweek5","0","null","2022-06-23T17:04:10Z","2022-06-29T21:50:14Z","ACTIVE","REGULAR","false","Vi_Ma_tO6YRDDweek5_Vin▒▒▒▒▒▒c▒dille_20220720T181513Z
 
It worked for me on Linux.

I used this file
Package_UTF8.txt
Code:
"dE82WVJ","CmFX","COMPLETED","false","Vinêâêîôûcédille TEST","en","PACKAGE","2022-07-20T18:15:13Z","","Vinêâêîôûcédille","2022-07-20T18:16:04Z","true","Electronic Disclosures and Signatures Consent","false","default-consent","tO6YRDDweek5","Vi","Ma","","","vi.ma@xyz.com","null","en","","","tO6YRDDweek5","0","null","2022-06-23T17:04:10Z","2022-06-29T21:50:14Z","ACTIVE","REGULAR","false","Vi_Ma_tO6YRDDweek5_Vinêâêîôûcédille_20220720T181513Z"

and got this result
Screenshot_at_2022-07-22_22-02-22_wvyyal.png


You didn't mention what OS you are using.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top