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]