Find in Files (special characters)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find in Files (special characters)
# 1  
Old 04-09-2010
Find in Files (special characters)

Well, I've searched the forum, but couldn't find an option, that would help me. I'm really a dummie in unix, so here it goes.

I've got like 50k files in a single catalogue. One of them contains a string:
Quote:
[Some random text]
Including the box/square brackets. I tried to find it manually, and use some search scripts, but they consider [] some sort of a special character. Tried to do \[text\] didn't work either.

Anyone knows, what to do?

If the issue has been already solved on this board previously, then I'm deeply sorry, but my dumb brain failed to find it. If so, please do not lock my topic without an explanation, and just point me towards to a solution, thanks.
# 2  
Old 04-09-2010
Code:
find /path/to/50k/files -type f -exec grep -l -F '[some random expression]' {} \;

grep -F 'pattern' uses a string not a regular expression.
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 04-10-2010
It works just fine. Thank you a lot. You, sir, are a genius! I salute you, Jim!
I consider the topic fulfilled.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find out special characters from xml file

Hi....I have a xml file which is having lots of special characters which I need to find out and put the distinct list of those into a text file. The list of special characters is not specific, it can be anything at different point of time. Can anyone help me to find out the same and list out? ... (10 Replies)
Discussion started by: Krishanu Saha
10 Replies

2. Shell Programming and Scripting

HOw to find special characters

I have flat file which has data like this glid¿as_liste¿025175456 How can I print these lines into new file? (4 Replies)
Discussion started by: sol_nov
4 Replies

3. UNIX for Dummies Questions & Answers

find text enclosed between special characters

Hi, I'm trying to find all DISTINCT words having _mr in the line and ENCLOSED in '/'. For eg below is the text in a file.. /database/new_mr254/1 /database/rawdb/views/new_mr254/1 /database/project/rawdb/tables/new_mr232/1 /database/project/rawdb/views/new_mr253/1... (5 Replies)
Discussion started by: northwest
5 Replies

4. Shell Programming and Scripting

Rename files and directories with special characters

Hello guys, I was looking for a shell script that removes all the special characters from the files and the subdirectories recursively. I could not locate it any more. Dose any body have a similar script that dose that? Thanks for the help. AV (0 Replies)
Discussion started by: avatar_007
0 Replies

5. UNIX for Dummies Questions & Answers

Files with special characters - how to remove

Hi, I have a directory that has a file which contained special characters in the filename. Can someone please advise how to remove the file, preferably with a rm -i ? Thanks in advance. Listing is as below: {oracle}> ls -1b bplog.bkup.001 bplog.bkup.002 bplog.bkup.003 bplog.bkup.004... (1 Reply)
Discussion started by: newbie_01
1 Replies

6. Shell Programming and Scripting

Single/Multiple Line with Special characters - Find & Replace in Unix Script

Hi, I am creating a script to do a find and replace single/multiple lines in a file with any number of lines. I have written a logic in a script that reads a reference file say "findrep" and populates two variables $FIND and $REPLACE print $FIND gives Hi How r $u Rahul() Note:... (0 Replies)
Discussion started by: r_sarnayak
0 Replies

7. Shell Programming and Scripting

Replace special characters in multiple files - perl

I have 100 files, where i want to search a set of strings and make the replacement by other strings In the first case I want to include a parameter in the name of a file LOG_DCT = $ LOG_DIR/DCT_GERAL_"$DATAINI".log replace to : LOG_DCT = $ LOG_DIR / DCT_GERAL_ $ 1_ "$ DATAINI". log I did... (1 Reply)
Discussion started by: RMSoares
1 Replies

8. UNIX for Dummies Questions & Answers

Find and replace special characters in a file

HI All I need a shell script ehich removes all special characters from file and converts the file to UTF-* format Specail characters to be removed must be configurable. strIllegal = @"?/><,:;""'{|\\+=-)(*&^%$#@!~`"; Please help me in getting this script as my scripting skilla are... (2 Replies)
Discussion started by: sujithchandra
2 Replies

9. UNIX for Dummies Questions & Answers

Help with find and replace w/string containing special characters

Can I get some help on this please, I have looked at the many post with similar questions and have tried the solutions and they are not working for my scenario which is: I have a text file (myfile) that contains b_log=$g_log/FILENAME.log echo "Begin processing file FILENAME " >> $b_log ... (4 Replies)
Discussion started by: CAGIRL
4 Replies

10. AIX

How to find special characters??

By more, vi, cat etc commands special characters (few control characters) are not identified. Is there any way to find out those? Thanks Sumit (3 Replies)
Discussion started by: sumitc
3 Replies
Login or Register to Ask a Question