[Techtalk] real life kewl text-processing and regexps samples
wanted
Carla Schroder
carla at bratgrrl.com
Fri Jan 9 20:28:19 EST 2004
On Friday 09 January 2004 7:14 pm, Elena Bevell wrote:
>
> I like this recursive grep that I found somewhere:
>
> find . -type f -exec grep "thing-to-find" {} \;
>
> note that there is no space between the two braces
> and no space between the backslash and the semicolon,
> but there is a space between the second brace and the backslash.
>
> Can someone explain the spaces and why this works?
>
Oo oo, me! The {} \; is a 'find' option. It executes any command, after
'find' does its finding bit. The curly braces represent the file being
operated on. Backslash escapes the semi-colon, which marks the end of the
command string.
You can replace -exec with -ok, and this prompts you at every step for
verification. -v of course is verbose. So let's say you were doing a big mass
chowning:
# find / -uid 750 -ok chown -v 800 {} \;
This will ask for confirmation on every file it finds, with much chatter.
--
~~~~~~~~~~~~~~~~~~~~~~~~~
Carla Schroder
www.tuxcomputing.com
this message brought to you
by Libranet 2.8 and Kmail
~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Techtalk
mailing list