Grep multiple phrasses containing quotation marks, slashes..?

P

postcd

Guest
Hello, this is part of my "find" command:
-exec grep -l "$phrasse" {} \; >> $outputfile

i want to ask how i can make it so i can search for not one, but twenty phrasses?

the search phrasses will contain example this:

url=<?php echo $rand_url;?>
\"http://www\"
\'http://www\'

thank you

:-O
 


Hello, this is part of my "find" command:


i want to ask how i can make it so i can search for not one, but twenty phrasses?

the search phrasses will contain example this:

url=<?php echo $rand_url;?>
\"http://www\"
\'http://www\'

thank you

:-O
Before we offer solutions to your question, please post the full command you are asking about, preferably in in code tags.
 
i dont want to reveal that command. assume i dont have any command, just grep. like: cat file | grep ***
 
i dont want to reveal that command. assume i dont have any command, just grep. like: cat file | grep ***
It would be difficult, if not impossible to answer your question properly without seeing the full command, or a sample command that replicates the problem you are asking about.

As for:
Code:
cat file | grep ***
You need not use 'cat' and pipe to 'grep', you only need to use grep:
Code:
$ grep "sometext" filename(s)

You should be studying the options for grep, either 'man grep' or 'info grep'. Hopefully this information will answer your questions.

BTW,
...assume i dont have any command...
Anything you type at the command prompt to perform some function, IS a command, or a series of commands. ('ls', cat' 'grep', etc...)

May I also suggest studying the Bash Beginners Guide at the Linux Documentation Project, along with other tutorials there.
 
Anyone else please? So far no solution for grepping multiple phrasses out of file. thx
 
egrep -f <file of phrases> input > output

Google egrep and or man it.
 
Thank You, egrep appears to work

Code:
-exec egrep -il "\/\* text \*\/|ssss" {} \;

i only have issue with commenting out some non standard characters like:

/
*

someone says this is a list of 5 characters that needs to be escaped by backslash:
Code:
^ $ . * \
 
Last edited:
For these regular expression characters ? + { | ( ) use \? \+ \{ \| \( \)

I'm not sure if this would help, but it will check for any printable character which is not a space or an alphanumeric character.

Code:
grep [[:punct:]] file-to-grep
 
Last edited:
WharRat: not sure what do you mean by check for characters, i think i mentioned what i need to search for, im not searchign for "punct"
 

Members online


Top