PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > grep doubt
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

grep doubt

Réponse
 
LinkBack Outils de la discussion
Vieux 24/04/2008, 14h25   #1
apogeusistemas@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut grep doubt


Hi:

Can you tell me why when I run this script I only get this output ?

solaris> cat script1

for file in `ls -R`
do
grep -iw alter $file > /apl/applprox/script1_output
grep -iw modify $file >> /apl/applprox/script1_output
grep -iw replace $file >> /apl/applprox/script1_output
done



grep: can't open OEXWFOIB.pls
grep: can't open OEXWFOIB.pls
grep: can't open OEXWFOIS.pls
grep: can't open OEXWFOIS.pls
grep: can't open OEXWFOIS.pls
grep: can't open OEXXHDRB.pls
grep: can't open OEXXHDRB.pls
grep: can't open OEXXHDRB.pls
grep: can't open OEXXHDRS.pls
grep: can't open OEXXHDRS.pls
grep: can't open OEXXHDRS.pls
grep: can't open OEXXLINB.pls
grep: can't open OEXXLINB.pls
  Réponse avec citation
Vieux 24/04/2008, 14h30   #2
pk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: grep doubt

On Thursday 24 April 2008 15:25, apogeusistemas@gmail.com wrote:

>
> Hi:
>
> Can you tell me why when I run this script I only get this output ?


(looks into the crystal ball...)

>
> solaris> cat script1
>
> for file in `ls -R`
> do
> grep -iw alter $file > /apl/applprox/script1_output
> grep -iw modify $file >> /apl/applprox/script1_output
> grep -iw replace $file >> /apl/applprox/script1_output
> done
>
>
>
> grep: can't open OEXWFOIB.pls
> grep: can't open OEXWFOIB.pls
> grep: can't open OEXWFOIS.pls
> grep: can't open OEXWFOIS.pls
> grep: can't open OEXWFOIS.pls
> grep: can't open OEXXHDRB.pls
> grep: can't open OEXXHDRB.pls
> grep: can't open OEXXHDRB.pls
> grep: can't open OEXXHDRS.pls
> grep: can't open OEXXHDRS.pls
> grep: can't open OEXXHDRS.pls
> grep: can't open OEXXLINB.pls
> grep: can't open OEXXLINB.pls


- Are you sure you fully understand the output of ls -R?
- what other output should you get? You are redirecting stdout.
- are you sure you fully understand redirection operators?

--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
  Réponse avec citation
Vieux 24/04/2008, 15h17   #3
apogeusistemas@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: grep doubt

On Apr 24, 10:30am, pk <p...@pk.invalid> wrote:
> On Thursday 24 April 2008 15:25, apogeusiste...@gmail.com wrote:
>
>
>
> > Hi:

>
> > Can you tell me why when I run this script I only get this output ?

>
> (looks into the crystal ball...)
>
>
>
>
>
>
>
> > solaris> cat script1

>
> > for file in `ls -R`
> > do
> > grep -iw alter $file > /apl/applprox/script1_output
> > grep -iw modify $file >> /apl/applprox/script1_output
> > grep -iw replace $file >> /apl/applprox/script1_output
> > done

>
> > grep: can't open OEXWFOIB.pls
> > grep: can't open OEXWFOIB.pls
> > grep: can't open OEXWFOIS.pls
> > grep: can't open OEXWFOIS.pls
> > grep: can't open OEXWFOIS.pls
> > grep: can't open OEXXHDRB.pls
> > grep: can't open OEXXHDRB.pls
> > grep: can't open OEXXHDRB.pls
> > grep: can't open OEXXHDRS.pls
> > grep: can't open OEXXHDRS.pls
> > grep: can't open OEXXHDRS.pls
> > grep: can't open OEXXLINB.pls
> > grep: can't open OEXXLINB.pls

>
> - Are you sure you fully understand the output of ls -R?
> - what other output should you get? You are redirecting stdout.
> - are you sure you fully understand redirection operators?
>
> --
> All the commands are tested with bash and GNU tools, so they may use
> nonstandard features. I try to mention when something is nonstandard (if
> I'm aware of that), but I may miss something. Corrections are welcome.- Hide quoted text -
>
> - Show quoted text -



I need find all occurences of alter, modify and replace in all files,
how could I make this ?

Thank you
  Réponse avec citation
Vieux 24/04/2008, 15h32   #4
Janis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: grep doubt

On 24 Apr., 16:17, apogeusiste...@gmail.com wrote:
> On Apr 24, 10:30am, pk <p...@pk.invalid> wrote:
>
>
>
>
>
> > On Thursday 24 April 2008 15:25, apogeusiste...@gmail.com wrote:

>
> > > Hi:

>
> > > Can you tell me why when I run this script I only get this output ?

>
> > (looks into the crystal ball...)

>
> > > solaris> cat script1

>
> > > for file in `ls -R`
> > > do
> > > grep -iw alter $file > /apl/applprox/script1_output
> > > grep -iw modify $file >> /apl/applprox/script1_output
> > > grep -iw replace $file >> /apl/applprox/script1_output
> > > done

>
> > > grep: can't open OEXWFOIB.pls
> > > grep: can't open OEXWFOIB.pls
> > > grep: can't open OEXWFOIS.pls
> > > grep: can't open OEXWFOIS.pls
> > > grep: can't open OEXWFOIS.pls
> > > grep: can't open OEXXHDRB.pls
> > > grep: can't open OEXXHDRB.pls
> > > grep: can't open OEXXHDRB.pls
> > > grep: can't open OEXXHDRS.pls
> > > grep: can't open OEXXHDRS.pls
> > > grep: can't open OEXXHDRS.pls
> > > grep: can't open OEXXLINB.pls
> > > grep: can't open OEXXLINB.pls

>
> > - Are you sure you fully understand the output of ls -R?
> > - what other output should you get? You are redirecting stdout.
> > - are you sure you fully understand redirection operators?

>
> > --
> > All the commands are tested with bash and GNU tools, so they may use
> > nonstandard features. I try to mention when something is nonstandard (if
> > I'm aware of that), but I may miss something. Corrections are welcome.- Hide quoted text -

>
> I need find all occurences of alter, modify and replace in all files,
> how could I make this ?
>
> Thank you


Somthing like...

find . -type f | xargs egrep -iw '(alter|modify|replace)' >outfile

(You need to tweak it slightly if your filenames contain e.g. spaces
and/or if your grep doesn't support option -w.)

Janis
  Réponse avec citation
Vieux 24/04/2008, 15h32   #5
mallin.shetland
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: grep doubt

apogeusistemas@gmail.com scrisse:

> I need find all occurences of alter, modify and replace in all files,
> how could I make this ?


grep -R -e alter -e modify -e replace *

PS Over fifty lines of quotation before a two line post: revise
your quoting style.

--
Bottom posting sucks!
  Réponse avec citation
Vieux 24/04/2008, 15h36   #6
pk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: grep doubt

On Thursday 24 April 2008 16:17, apogeusistemas@gmail.com wrote:

> I need find all occurences of alter, modify and replace in all files,
> how could I make this ?


If you want just this (and I think you don't, at least interpreting your
previous post), then you can do

find /src/dir -type f -exec egrep 'alter|modify|replace' '{}' \;

If you need to do more things or something else, you have to be more precise
in specifying what you want.

--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
  Réponse avec citation
Vieux 24/04/2008, 16h03   #7
apogeusistemas@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: grep doubt

On Apr 24, 11:36am, pk <p...@pk.invalid> wrote:
> On Thursday 24 April 2008 16:17, apogeusiste...@gmail.com wrote:
>
> > I need find all occurences of alter, modify and replace in all files,
> > how could I make this ?

>
> If you want just this (and I think you don't, at least interpreting your
> previous post), then you can do
>
> find /src/dir -type f -exec egrep 'alter|modify|replace' '{}' \;
>
> If you need to do more things or something else, you have to be more precise
> in specifying what you want.
>
> --
> All the commands are tested with bash and GNU tools, so they may use
> nonstandard features. I try to mention when something is nonstandard (if
> I'm aware of that), but I may miss something. Corrections are welcome.




Is there any ls command to show me complete file´s pathname ?

How could I get this ?

Thank you.

  Réponse avec citation
Vieux 24/04/2008, 16h15   #8
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: grep doubt

On 2008-04-24, apogeusistemas@gmail.com <apogeusistemas@gmail.com> wrote:
>
>
> Is there any ls command to show me complete file´s pathname ?
>
> How could I get this ?
>

Use find.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 18h45.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14052 seconds with 16 queries