The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Grep command nickg UNIX for Dummies Questions & Answers 14 10-06-2008 08:22 AM
grep command christine33990 UNIX for Dummies Questions & Answers 11 05-05-2008 11:45 PM
how to exclude the GREP command from GREP yamsin789 UNIX for Advanced & Expert Users 2 10-04-2007 11:59 PM
grep command help ishmael^soyuz Shell Programming and Scripting 4 07-11-2007 06:01 AM
grep command debasis.mishra Shell Programming and Scripting 1 03-27-2006 10:53 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-22-2006
Registered User
 

Join Date: Apr 2006
Posts: 21
grep command

I need to search the follwowing syntax in all the file in the directory
How to user grep command

If the below syntax is present it should display

if [ 1 -eq 2 ]; then # scissors
Reply With Quote
Forum Sponsor
  #2  
Old 11-22-2006
Registered User
 

Join Date: Nov 2006
Posts: 21
can u brief your question?
Reply With Quote
  #3  
Old 11-22-2006
Registered User
 

Join Date: Apr 2006
Posts: 21
grep command

I have 300 files in the directory. I need to find out below syntax in which files it is available

if [ 1 -eq 2 ]; then # scissors

ps -ef |grep "scissors" *.* (this syntax is not working)
Reply With Quote
  #4  
Old 11-22-2006
Registered User
 

Join Date: May 2006
Location: England
Posts: 265
Quote:
Originally Posted by pmsuper
I have 300 files in the directory. I need to find out below syntax in which files it is available

if [ 1 -eq 2 ]; then # scissors

ps -ef |grep "scissors" *.* (this syntax is not working)
What is the control for the test

if [ 1 -eq 2 ];

What are you trying to do with the # as this is commenting out scissors?!

Sorry but what is the ps -ef | grep "scissors *.* supposed to be doing?

Also no fi at the end of the if so it will not work anyway!
Reply With Quote
  #5  
Old 11-22-2006
Registered User
 

Join Date: Nov 2006
Posts: 21
can u give me the directory structure cos the the syntax what u have given is */* which means that u r searching for a pattern in current directory say

X, 1st * tells to search the pattern in all the directories under X
2nd * i,e /* tells to get into each of * directories under X, search in all the files under each of * directories.

Hope u got my pt.

rgds,
jam
Reply With Quote
  #6  
Old 11-22-2006
Registered User
 

Join Date: Apr 2006
Posts: 21
grep

> grep -i scis *
RecreateAIUMajorAccounts:if [ 1 -eq 2 ]; then # scissors venkat

This syntax(if [ 1 -eq 2 ]; then # scissors venkat) is present in the file RecreateAIUMajorAccounts
Reply With Quote
  #7  
Old 11-22-2006
Read Only
 

Join Date: Jun 2006
Posts: 105
grep '\[ 1 \-eq 2 \]; then' *

Hope this works. I dont know why you are using ps it just lists the processes running in the unix box. The above should help you
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0