gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Re: File naming conventions


From: John Meinel
Subject: Re: [Gnu-arch-users] Re: File naming conventions
Date: Tue, 19 Oct 2004 00:25:04 -0500
User-agent: Mozilla Thunderbird 0.8 (Windows/20040913)

Zenaan Harkness wrote:
Actually, I really wish grep had the workaround, because otherwise I have to do this little hack:

grep -rn "what I want" * | grep -v "{arch}/"

which means it still has to grep all of those files, it just doesn't tell me about it.


So reverse your greps.


That doesn't actually work. Because the final grep is actually greping out the filename given by the first grep, not the text in the file. Something that might work is:

$ find . ! -path "*arch*" -print0 | xargs -0 -n50 grep -rn "what I want"

That's quite a bit to type all the time, though I think it will always work.

I suppose I could define the alias:

$ alias noarchgrep='find . ! -path "*arch*" -print0 | \
        xargs -0 -n50 grep -rn'

I think if I type:
$ noarchgrep "what I want"

it does the right thing.

I don't really like aliases for only moderately used commands, though. Because I might not have set them on all of the machines that I use, and I frequently forget about them. That's one of the beauties of Unix. I know how find/grep/sed/etc works, and I can build up what I want from that, rather than having to remember 500 special case commands.

John
=:->

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]