bash command

a. What does find *neptune* want to do ?  does it want to find a file content inside 20150706.log.gz
b. What's the purpose of zgrep -l and zcat
c.  What's the purpose of {} ?

Tks

#1find *neptune* - type f -name "20150706.log.gz" -exec zcat {} \;
#2 find *neptune* - type f -name "20150706.log.gz" -exec zgrep -l "music.wmv" {} \;
AXISHKAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gerwin Jansen, EE MVETopic Advisor Commented:
Try 'man find' :)

*neptune* is the path where find is going to look for -type f (=files) that have that .gz name.

So this would mean it searches in pathnames that contain the string neptune so one_neptune or neptunt_number1 would match.

When found, the zcat command is executed with that file name as a parameter.

The second command is searching for text music.wmv in that .gz file
woolmilkporcCommented:
find does never search for file content.

find *neptune* searches all files and subdirectories directly below the current directory whose names contain "neptune" for a file/files (-type f) named "20150706.log.gz". Matching directories found directly below the current directory are then searched recusively, as is the default for "find".
In fact, this does only make sense for directories containing "neptune" in their names, since a file containing "neptune" in its name can never be named "20150706.log.gz"!
By the way, the space between "-" and "type" is wrong!

"zgrep" and "zcat" do the same as their counterparts "grep" and "cat" but can work against compressed/gzipped files by first uncompressing/ungzipping them on the fly.
"-l" of zgrep/grep means: show only the names of files with matching content, not the content itself.

{} is a placeholder used in find for the "-exec" directive holding the results of the find command, one by one, thus effectively a loop over the results of find is performed, applying the command specified after " -exec" and before "\;"  to all the results of find, one after the other.

\;  must be present to terminate the command string to be processed by "-exec".

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Zephyr ICTCloud ArchitectCommented:
I think a site like explainshell.com might be helpful for you, because I see you have a few questions regarding the shell, which is not a bad thing, but this site will help you learn what it all does.

Check out what it does with your first string:

example
AXISHKAuthor Commented:
Tks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.