Article View: demon.ip.developers
Article #170Re: grep 'n edit, I wish!
From: Graham E Kinns
Date: Wed, 11 Nov 1998 00:00
Date: Wed, 11 Nov 1998 00:00
43 lines
2028 bytes
2028 bytes
In article <910784101snz@wash.demon.co.uk>
john$@wash.demon.co.uk "John Washington" writes:
>I constantly find myself typing things like:
>
> grep foobar *.c
> [pause to eyeball result]
> edit thisfile.c thatfile.c tother.c yafile.c etc.c
>
>And that really bugs me. The damn computer knows which files
>I want already. I could even have used the -l option in grep
>to get a little list of them.
>Oh, and yes OF COURSE it's easy-peasy in Unix, but being a
>dinosaur I'm running msdos.
If you have a DJGPP compiled editor & grep:
grep -l foobar *.c | xargs emacs (xargs is from findutils)
or if you're into bash:
bash -c 'emacs `grep -l foobar *.c`'
or just:
grep -l foobar *.c > cmdfile
emacs @cmdfile
Depending on the editor, you could call grep -l from within the
editor and parse the results. Alternatively something like
'emacs *.c' and search the files from within the editor. I believe
there's a DJGPP port of VIM available...
Current DJGPP FAQ for reference:
ftp://ftp.demon.co.uk/pub/mirrors/simtelnet/gnu/djgpp/v2/faq211b.zip
Cheers, Graham.
--
Graham E. Kinns -------------------------- <Graham@grempc.demon.co.uk>
"I've done many things that have gotten very popular but amongst a
sorta nerdy community ... because the kinda stuff I do is stuff that
I have no idea how to explain it to my mom" - James Gosling.
Technical Details
Message-ID:
<910820839.98081534.snz@grempc.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<910784101snz@wash.demon.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10bb05,f355ae5d069fba47 X-Google-Attributes: gid10bb05,public From: Graham E Kinns <Graham@grempc.demon.co.uk> Subject: Re: grep 'n edit, I wish! Date: 1998/11/11 Message-ID: <910820839.98081534.snz@grempc.demon.co.uk> X-Deja-AN: 410888101 X-NNTP-Posting-Host: grempc.demon.co.uk:158.152.48.248 References: <910784101snz@wash.demon.co.uk> X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 910826904 nnrp-06:16005 NO-IDENT grempc.demon.co.uk:158.152.48.248 Organization: Home, Cambridge, UK Newsgroups: demon.ip.developers