The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 11:22 AM
grep command christine33990 UNIX for Dummies Questions & Answers 11 05-06-2008 02:45 AM
how to exclude the GREP command from GREP yamsin789 UNIX for Advanced & Expert Users 2 10-05-2007 02:59 AM
grep command help ishmael^soyuz Shell Programming and Scripting 4 07-11-2007 09:01 AM
grep command debasis.mishra Shell Programming and Scripting 1 03-28-2006 01:53 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-22-2006
pmsuper pmsuper is offline
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
  #2 (permalink)  
Old 11-22-2006
jam_prasanna jam_prasanna is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 21
can u brief your question?
  #3 (permalink)  
Old 11-22-2006
pmsuper pmsuper is offline
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)
  #4 (permalink)  
Old 11-22-2006
johnf johnf is offline
Registered User
  
 

Join Date: May 2006
Location: England
Posts: 284
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!
  #5 (permalink)  
Old 11-22-2006
jam_prasanna jam_prasanna is offline
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
  #6 (permalink)  
Old 11-22-2006
pmsuper pmsuper is offline
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
  #7 (permalink)  
Old 11-22-2006
dhanamurthy dhanamurthy is offline
Registered User
  
 

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
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0