The Linux Community Forum

General Help & Advice => Linux Support => Topic started by: bociub on September 22, 2021, 09:36:40 pm

Title: grep {} \;
Post by: bociub on September 22, 2021, 09:36:40 pm
Hi folks,
I am a student and looks like nearly impossible to google out what the "{}" and the \; want to exactly mean in this command:

find /usr/share/doc -type f -exec egrep -i -H -1 '3d (modeling|printing)' "{}" \; | cut -c -100

Can anyone enlighten me?

Title: Re: grep {} \;
Post by: Brian000 on September 22, 2021, 11:49:57 pm

I assume you know the rest of the command but:
"Find all files in /usr/share/doc and execute egrep (with various parameters) for all files, but return only the 100th character. "

The "{}" means all files from the find command (think of it as a variable or an array/collection containing the return from the "find" command)
while the /; is the command terminator with an escape character "\" to stop it from being interpreted as part of the command.

SimplePortal 2.3.3 © 2008-2010, SimplePortal