prashant_n_mhatre
asked on
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
Thanks
ASKER
Thanks HamdyHassan !!!
I know "grep". I don't know how to use ascii-128 character code for search.
I know "grep". I don't know how to use ascii-128 character code for search.
idea, to dump the file and search the dump
prompt> od -c filename | grep 307
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
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
ASKER
i'm doing the same. I'm wondering...Is there any command that can directly take care of this..
ASKER
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.
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
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
\307 is C-language escapes for ASCII 128
and when you use "od -c " it appears as 307.
ASKER
will it be 307 or 200?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hmm. Is there an ascii 128 character? man ascii, I don't see it in there.
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"
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"
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
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
Hi,
the script below achieves your need.
for f in `ls`
do
awk '/\200/ {print FILENAME}' $f
done
good luck!
the script below achieves your need.
for f in `ls`
do
awk '/\200/ {print FILENAME}' $f
done
good luck!
ASKER
Thank you all for your help and suggestions.
-l will return only filename
about char(128) let me tested first