Sunday 15 April 2012

perl - Attempting to pull just filename from backtick -


I have an issue where I'm trying to drag only one file name from the output of the backtick, my code The following is as follows: $ var = 'Manapak -f filename';

If anyone is familiar with mpack, then the output will be something like this:

  tempdesc.txt: file exists file_20130620.zip (application / octet -stream)   

I'm just trying to get the file name, however, all my attempted regexes have failed. I've just tried to remove the line breaks and then tried to process the information and I can not. I thought that they could be just white space and remove white space but those reggaes have failed. I can go through this medium and try to pull every reggae with this data and I can provide it if necessary, but maybe someone has something that can work Can not produce output such that the ID does not change the output in any way. So to clarify something, I'm just looking for a few things which will only produce the filename: file_20130620.zip

Some suggestions given with the output:

 < Code> $ var = ~ m {^ (. +?) \ (} M and print "$ 1 \ n"; Output: tempdesc.txt: File exists file_20130620.zip ($ filename) = $ var = ~ / ( ? S:. * \ \) (. *) \ ([^]] + \) \ N /; Output: tempdesc.txt: File exists file_20130620.zip if ($ var = ~ / \ S +: [ ^ \ N] + \ n (\ S +) [^ \ n] + \ n /) {printf $ 1;} output: tempdesc.txt: file exists   

fix copy Ysth:

  $ var = 'manpec -f Filename 2 & gt; / dev / null`; #will Remove 'tempdesc.txt: file exists'    

The filename believes that before the first line of output on the last line of a bracketed mime type:

  ($ filename) = $ var = ~ /? :. ************************************************************************************************** ****************)] \) \ n /; Although   

I will create a temporary directory (use File :: Temp) and select a file in between the unpack and output pars. >

It is possible that the file present warnings are not actually in $ var , but are visible in your output because the manipers are writing it on stderr (which is backlit Does not capture) munpack -q -f ... or munpack -f ... 2 & gt; Try to / dev / null

No comments:

Post a Comment