Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cat log ¦ grep =http doesnt match the = in =http 1

Status
Not open for further replies.

linuxMaestro

Instructor
Jan 12, 2004
183
US
cat log | grep =http doesnt match the = in =http, it matches everything that has http not just the ones that have =http.

How can I get it to match just the lines with =http?

I tried \=http but it still matches everything with just http

Danks!
 
Have you tried this ?
Code:
grep -F '=http' log
If your grep version don't like the -F option, try this:
Code:
fgrep '=http' log

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
This command doesnt return anything even though I know there are files that contain "include"

for i in `ls -R | grep *.php` ; do fgrep "include" $i ; done

Why wont it work?
 
Please, start a new thread as your post is off topic.
 
PHV is rigth but ...
I don't know how it works in Linux but in AIX a "ls -R" commands doesn't produce a list of files complete of pathnames, but for each subdirectory a list of files contained in, i.e.
goofy (directory name):
file1
file2
file3
goofy/mickey
filex
filey
filez

In this way the $i var in your loop never point to a full pathname but to a relative filename
 
Use 'find' instead of 'ls'
[tt]
for i in `find . -type f -name '*.php'`; do fgrep "include" $i ; done
[/tt]

You can also do the same thing without the for loop :
[tt]
find . -type f -name '*.php' -exec fgrep 'include' {} \;
[/tt]

Jean Pierre.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top