Thanks Rob and James, I used the match for everything after and including the slash up until the white space and it works a treat.
-----Original Message----- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: 13 August 2003 14:47 To: [EMAIL PROTECTED] Subject: Re: regular expresion question. Jas Grewal wrote: > > 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. Hi Jas. Take a look at the code below. It will find the first sequence of non-space characters starting with a slash. Is that what you need? It depends on what is in the '* * *' stuff. HTH, Rob use strict; use warnings; my $line = '30 23 * * * /usr/lbin/sa/sa1 600 6'; my ($path) = $line =~ m{(/\S+)}; print $path, "\n"; OUTPUT /usr/lbin/sa/sa1 -- 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]