Find ASCII character in a file

I'm using a Korn Shell. I need to find all files in a directory having character with ascii code 128. Can you please help?
Thanks
LVL 4
prashant_n_mhatreAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HamdyHassanCommented:
grep -l "search_pattern" *

-l will return only filename

about char(128)  let me tested first
0
prashant_n_mhatreAuthor Commented:
Thanks HamdyHassan !!!
I know "grep". I don't know how to use ascii-128 character code for search.
0
HamdyHassanCommented:

idea, to dump the file and search the dump

prompt> od -c filename | grep 307




0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

HamdyHassanCommented:
Why 307 ?


1557 bin/ee> cat filename.txt
hello
char 128 is  Ç


1556 bin/ee> od -c filename.txt
0000000   h   e   l   l   o  \n   c   h   a   r       1   2   8       i
0000020   s         307  \n
0000025

-----------------
what -c means ?
-----------------
    -c        Display  single-byte  characters.   Certain   non-
               graphic  characters  appear as C-language escapes:
               null=\0, backspace=\b, form-feed=\f,  new-line=\n,
               return=\r,  tab=\t; others appear as 3-digit octal
               numbers.  For example:
               echo "hello world" | od -c
               0000000   h   e   l   l   o       w    o    r    l
               d  \n
               0000014

0
prashant_n_mhatreAuthor Commented:
i'm doing the same. I'm wondering...Is there any command that can directly take care of this..
0
prashant_n_mhatreAuthor Commented:
Sorry..your another comment was not there when I posted this. I'm not looking for a pattern "char-128". I'm having a character in a file whose ascii value is 128.
0
HamdyHassanCommented:
Yes, I know you are looking for char with ascii value 128

which is listed at the ascii table
http://www.dotnet4all.com/default.asp?NavID=486

128  Ç

for some reason, when I post, EE convert "Ç" to  "G"

Any way, try
prompt> od -c filename | grep 307

and let me know if that working or not
0
HamdyHassanCommented:

\307 is C-language escapes for ASCII 128

and when you use "od -c " it appears as 307.


0
prashant_n_mhatreAuthor Commented:
will it be 307 or 200?
0
rob-gCommented:
prashant_n_mhatre,

Use echo to create an environment variable that holds the ascii 128 character. echo deals in Octal so this is actually 0200.
You can then use this as the pattern parameter to grep, e.g.

search_char=`echo "\0200"`
grep -l ${search_char} *
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jimbbCommented:
Hmm.  Is there an ascii 128 character?  man ascii, I don't see it in there.
0
rob-gCommented:
Ascii codes go beyond that shown in man ascii.
The characters beyond this range cover the multinational character set (e.g. the French c-cedilla ascii 231).

Try the following to display a Scandinavian (?) 'o' character (ascii 248).

echo "\0370"
0
HamdyHassanCommented:
It's \0307  not \0200

and yes it's working using grep echo idea

1592 bin/ee> grep `echo "\0307"` filename.txt
char 128 is  Ç


so you can use the following command

grep -l `echo "\0307"` *

where
` is back quote



             
0
SantunesCommented:
Hi,
the script below achieves your need.

for f in `ls`
do
 awk '/\200/ {print FILENAME}' $f
done


good luck!
0
prashant_n_mhatreAuthor Commented:
Thank you all for your help and suggestions.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.