![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Dont want to change the codepage of a unicode file | shibajighosh | AIX | 0 | 05-12-2008 09:21 PM |
| Find Unicode Character in File | azelinsk | Shell Programming and Scripting | 1 | 04-11-2008 06:46 PM |
| unicode problem | Akimaki | High Level Programming | 3 | 03-19-2007 07:00 PM |
| How to display unicode characters / unicode string | jackdorso | High Level Programming | 3 | 05-20-2005 10:09 AM |
| unicode | rein | UNIX for Advanced & Expert Users | 2 | 01-18-2005 10:40 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
grep and UNICODE (utf-16) file
I'm using shell scripting in Applescript. When searching a file with the ANSEL character set (for GEDCOM files) using (grep '1 CHAR ANSEL' filepath) gives the expected result. When searching a UNICODE formatted file (utf-16), searching for text known to exist in the file using (grep '1 CHAR UNICODE' filepath) does not find the string in the file.
How can I grep this UNICODE file? Thanks in advance. |
| Forum Sponsor | ||
|
|
|
|||
|
i think utf (8/16) format files doenst have the default end-of-line identifier in such a case, the usual tools applied to other text files cannot be used with.
Try running a wc -l on the file and post the output of number of lines, for pure utf formatted files it would return a zero; for such situations customized codes need to be written. |
|
|||
|
thanks Jim. My Mac installation does have iconv. I'll use a pipe instead, to avoid having to delete a temp file. All I need is a true or false:
iconv -f UTF-16 -t UTF-8 myfile | grep '1 CHAR UNICODE' works for me. I am such a novice I don't know how to find a list of commands available to me. |
|||
| Google The UNIX and Linux Forums |