On Wednesday, August 13, 2003, at 08:28 AM, Jas Grewal ((DHL UK)) wrote:

Hi all,

Howdy.


I am trying to write a regular expresion to get a file path from a cron file, I have issolated the required lines, but am having problems with extracting just the file path and name.
 
The line is as follows :
 
30 23 * * * /usr/lbin/sa/sa1 600 6
 
I inned to extract just the '/usr/bin/sa/sa1' section.
 
Any guidance would be appreciated.

Not knowing much about your file, I'll assume no entries contain whitespace characters. If this is not true, you'll need to find another way. Given that, if you have a line in $line, try this:


my $path = (split ' ', $line)[5];

That just splits the line on whitespace and chooses the 6th element of the resulting list to put in $path.

Hope that helps.

James Gray

Jas
 
 
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to