How to grep � symbol?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to grep � symbol?
# 8  
Old 04-06-2019
Thank you Rudic,
This way, gives: invalid range end error.
Code:
printf '%b' "$(printf '\\U%x' {128..131})" | grep -l "[^\x00-\x7F]"

Somehow, I am printing the filenames now but info is not correct.
sniff.sh
Code:
for file in *.srt
do
printf '%b' "$(printf '\\U%x' {128..131})" $file '\n'
done

Output:
Code:
����1.hr.srt
,����JohnnyEnglishStrikesAgain2018.el.srt
����JohnnyEnglishStrikesAgain2018.en.srt

Normally there is no � inside *.en.srt

The answer seems like related to another case. Maybe files should be converted to UTF-16 encode prior to run this script.

I am closing this thread as solved.

Kind regards
Boris
# 9  
Old 04-06-2019
Try
Code:
printf '%b' "$(printf '\\U%x' {128..131})" | LC_ALL=C grep -lo '[^\x00-\x7F]'
(standard input)

which should be exactly what you need...?
# 10  
Old 04-06-2019
That command gives only standart output
In my understanding, all those commands I have tested so far prints only all srt files but do not search for related charbase string. Then I supposed the reason was not having other language options in my computer*and then added other languages (example:Greek) with locale-gen command.
This issue is not relevant to keyboard language settings.

By using iconv command, I also checked if original file size and converted file size were different. If I could have found any difference, I would have been thinking of adding a size comparison function inside the script but no luck..
PS: Also I have compared char length at each line.


Kind regards
Boris

Last edited by baris35; 04-06-2019 at 02:52 PM.. Reason: edit
# 11  
Old 04-06-2019
Hello,
Solved permanently ... Trick is du -b, not du -sh


Thank you
Boris
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

On £ symbol

Hi All, How do i represent £ symbol in unix and how to retain £ symbol in file. Thanks in Advance (3 Replies)
Discussion started by: HemaV
3 Replies

2. UNIX for Advanced & Expert Users

Undefined Symbol

When I try to link a .so file I get the undefined symbol error. Though I have the library file in my system. The compile and linking commands used are as follows g++ -m64 -g -Wall -I./include -c dxl_sample.c g++ -o firstprogram -m64 -g -Wall -I./include -Bdynamic... (1 Reply)
Discussion started by: Ranadeep Ghosal
1 Replies

3. Programming

Undefined Symbol

When I try to link a .so file I get the undefined symbol error. Though I have the library file in my system. The compile and linking commands used are as follows g++ -m64 -g -Wall -I./include -c dxl_sample.c g++ -o firstprogram -m64 -g -Wall -I./include -Bdynamic... (1 Reply)
Discussion started by: Ranadeep Ghosal
1 Replies

4. UNIX for Dummies Questions & Answers

grep line for string up to symbol

Hi, I would like to extract a pattern from a line. The first two characters will always be the same in this pattern, but the proceeding numbers will not be, and the pattern will always be 6 characters long. I would like to get the entire pattern up to a certain symbol, in this case, a period. ... (3 Replies)
Discussion started by: goodbenito
3 Replies

5. Solaris

/usr/lib/passwdutil.so.1: symbol __nsl_fgetspent_r: referenced symbol not found

deleteing post (0 Replies)
Discussion started by: dshakey
0 Replies

6. Shell Programming and Scripting

how to have ENTER after each symbol.

I want to know script for Input file : 123456789 outputfile : 1 2 3 4 5 6 7 8 9 now please how can generalize it like i want output : 123 456 789 (5 Replies)
Discussion started by: sparkriver
5 Replies

7. UNIX for Dummies Questions & Answers

grep problem with the ^ symbol, help needed please.

Hello I am new to this forum and have been perplexed by this issue for the last hour of my life, I've tried to search everywhere for a solution to my syntax error, but here is my code. grep -wvnf 'noise.dat' sample.out | sort output: 4:Java Swing 5:Swing Java 6:Software Requirements... (2 Replies)
Discussion started by: Gvsumrb
2 Replies

8. UNIX for Dummies Questions & Answers

The > symbol

Hi guys, Im new to unix; I have a problem at hand. Somehow at the terminal, I lost the command prompt, instead I get a ">" symbol. Anything I type in does me no good. What do you recommend? Thank you for your help. (3 Replies)
Discussion started by: csb
3 Replies

9. Programming

Symbol files

How to generate the symbol file for "C" program which will help me in analysing the core dump. Can any one suggest me the tools to use. I don't whether the gcc has the option to generate symbol file while generating the object code. (1 Reply)
Discussion started by: jkolla
1 Replies

10. Programming

c++ unresolved symbol

I have this problem: # make gcc -g -D_REENTRANT -DDISABLE_MJPEG=1 -I. -o encmain.o -c encmain.cc ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_max_size collect2: ld returned 8 exit status but from /usr/local/include/g++v3/bits/basic_string.h : namespace... (0 Replies)
Discussion started by: thalex
0 Replies
Login or Register to Ask a Question