We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
soubalaji does not need double quote interpolation, as there are no perl variables that might need expansion embedded in his command string. Instead he needs glob expansion. ./paz0*/home/fdm*/logs/*CYUTI*21* presumably expands to a long list of matching files, which he wants to filter with gzgrep(*). Running a command via backticks ought to invoke a shell to do the expansion, however as I recall the shell invoked is sh which has few features compared with bash or the like. If it where me, I would implement the whole thing in perl, that is use glob or File::Glob to expand the glob patten to a list of files, then open each through a zcat filter searching for matching lines. Alternatively, soubalaji could use perl to expand the glob, feed that list into gzgrep, and then capture and filter the output. Something like:
Note that the second use of grep is the internal perl function, and it is used to filter the list of matching lines that we get when the filehandle on the gzgrep command is called in an array context. (*) could gzgrep be a typo? On my system the command to grep gzip compressed files is zgrep In reply to Re^2: Use Unix command in Perl
by chrestomanci
|
|