|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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! |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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. |
|
![]() |
| Outils de la discussion | |
|
|