Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
112 user(s) are online (101 user(s) are browsing Forums)

Members: 0
Guests: 112

more...

Support us!

Headlines

 
  Register To Post  

[SOLVED] using grep
Quite a regular
Quite a regular


See User information
Hi All,
this might sound like a stupid question which I could find the answer in the doc but err no I did not find it...

I am looking for the word "wizard" inside a bunch of .c files so I am launching grep (os4 version, not from the sdk) :
grep -V
GNU grep 2.5.4

grep wizard *
grep: *: No such file or directory
grep wizard *.*
grep: *.*: No such file or directory
grep wizard #?.c
grep: #?.c: No such file or directory
grep wizard *.c
grep: *.c: No such file or directory

but
grep wizard apotion.c button6.c
does work but I dont want to do that because the drawer contains 400 files !

so what is supposed to be the right way of searching a word inside a bunch of files ??


Edited by Lio on 2010/4/13 18:01:41
Go to top
Re: using grep
Just popping in
Just popping in


See User information
@Lio

Don't know much about this grep thing, but at least we have:
SEARCH #?.c wizard QUICK

(think Amiga )

Go to top
Re: using grep
Just can't stay away
Just can't stay away


See User information
@Lio

In my experience the grep command only works if you use it from abc-shell (sh).

Go to top
Re: using grep
Just can't stay away
Just can't stay away


See User information
@Lio

I've got an earlier version of (I believe) the same grep:

$ grep -V
grep (GNU grep) 2.5

I can e.g. in my S:Arexx dir do "grep date *.rexx" and get all the lines containing "date" in the ARexx scripts with a .rexx extension, like you'd expect. And this is the regular AmigaShell, not ABCShell. Maybe there's a problem with the newer 2.5.4?

But I agree with the suggestion of using Search instead. Works fine.

Best regards,

Niels

Go to top
Re: using grep
Just popping in
Just popping in


See User information
@Lio

can u try these :

grep -r wizard /path to folder/

grep -l 'wizard' *.c

grep -l 'wizard' /path to folder/*.c

Go to top
Re: using grep
Quite a regular
Quite a regular


See User information
@angelheart

Quote:

angelheart wrote:
@Lio

can u try these :

grep -r wizard /path to folder/

grep -l 'wizard' *.c

grep -l 'wizard' /path to folder/*.c


here is the outcome :
6.JHO:Freedink-OS4/dink/Story> grep -r wizard JHO:Freedink-OS4/dink/Story/
grep: JHO:Freedink-OS4/dink/Story/: Not a directory
6.JHO:Freedink-OS4/dink/Story> grep -l 'wizard' *.c
grep: *.c: No such file or directory
6.JHO:Freedink-OS4/dink/Story> grep -l "wizard" *.c
grep: *.c: No such file or directory
6.JHO:Freedink-OS4/dink/Story> grep -l 'wizard' JHO:Freedink-OS4/dink/Story/
6.JHO:Freedink-OS4/dink/Story> grep -l 'wizard' JHO:Freedink-OS4/dink/Story/>ram:test
grep: JHO:Freedink-OS4/dink/Story/>ram:test: Invalid argument
6.JHO:Freedink-OS4/dink/Story> grep -l 'wizard' JHO:Freedink-OS4/dink/Story/ >ram:test
6.JHO:Freedink-OS4/dink/Story> grep -l 'wizard' JHO:Freedink-OS4/dink/Story/*.c
grep: JHO:Freedink-OS4/dink/Story/*.c: No such file or directory
6.JHO:Freedink-OS4/dink/Story> grep -l "wizard" JHO:Freedink-OS4/dink/Story/*.c
grep: JHO:Freedink-OS4/dink/Story/*.c: No such file or directory

@ Centaurz : nice, I did not know search could work like this ! thanks

@ all : thx for your help ! I think the tip of CentaurZ is much more amiga-ish (and working) then grep !

Go to top
Re: [SOLVED] using grep
Just popping in
Just popping in


See User information
@Lio

AFAIK grep has always worked with * as a wildcard until the previous (and the latest) SDK, and this has not been fixed so far. "grep" below is the working version, while "grep_new" the latest one.

grep 782680 ----rwed 23-Maj-09 12:26:09
grep_new 370066 ----rwed 15-Avg-09 23:55:52

I can PM you this version if interested, grep is a very fast and handy tool.

Varthall

Go to top
Re: [SOLVED] using grep
Quite a regular
Quite a regular


See User information
@Varthall

thx for the proposition but the "search" amigados command did the job fine

Go to top
Re: [SOLVED] using grep
Quite a regular
Quite a regular


See User information
@Lio

salass00 is correct, type sh first...

if you don't have sh, install the entire SDK environment

hmm, who ever compiled that native version of grep you're using perhaps didn't change the path logic? funny how people do straight ports of such things and don't consider those things...

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: [SOLVED] using grep
Just can't stay away
Just can't stay away


See User information
@Slayer

Or simply download abc-shell from here:
http://os4depot.net/index.php?functio ... ent/utility/abc-shell.lha

According to the version strings this should be the same version as in the latest SDK.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project