LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-16-2004, 12:10 AM   #1
overbored
Member
 
Registered: Jun 2003
Posts: 58

Rep: Reputation: 15
grep on Unicode files


I installed Cygwin and I'd like to grep some Unicode files to see what lines it's used on, but all I get is the following:

Code:
$ grep -ni '\bI\b' Pronouns.txt
Binary file Pronouns.txt matches

$ grep -niU '\bI\b' Pronouns.txt
Binary file Pronouns.txt matches

$ grep -V
grep (GNU grep) 2.5

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Does anybody know how to make grep work with Unicode files? Or are there any command-line tools that can convert Unicode to/from ASCII?

Thanks in advance.
 
Old 07-18-2004, 05:26 AM   #2
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Try grep -a or grep --binary-files=text, they are the same thing.
 
Old 07-18-2004, 01:12 PM   #3
wipe
Member
 
Registered: Jun 2004
Location: High Green
Distribution: Fedora Core 4
Posts: 180

Rep: Reputation: 30
The current stable version of GNU grep seems to (still) be 2.5.1. It's a bugfix update from 2.5. I don't know what the bugs were though. Both versions should be able to handle all usual flavours of Unicode. The problem might be in Cygwin or your text files (try other editors).

There is a standard tool for encoding conversions called iconv. It's distributed with the GNU C library but it's a commandline utility as well. I believe pretty much every programming and scripting language has an iconv interface of some sort.

Simon
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can you specify which files to grep search? sneakyimp Linux - Software 4 10-12-2005 08:28 PM
cp files from grep results Sigkill(9) Linux - Newbie 2 08-22-2005 03:17 PM
How to use grep to look for files that have linex and liney davholla Linux - General 5 12-09-2004 05:50 AM
Can't access winxp (unicode) files from linux FTP server... taligent Linux - Networking 1 05-25-2004 12:09 AM
How to filter files in files and files which are in a sub-directory with "grep"? Piero Linux - Newbie 9 08-29-2003 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration