[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: need help with awk



On  0, Guillaume CHARDIN <guillaume.chardin@gmail.com> wrote:
> Hi,
>
> In a backup process of some xen virtual machine, i need to extract in
> the config file some informations (in fact the disk line) .
> The line look like this :
>              disk = [ file:/path/to/file,sda1,w ]
> my goal is to isolate le `file` part to use it later. I'm a beginner
> with sed/grep and [...]

I know this isn't the answer you were looking for, but here is an easy way to
isolate it in Perl;

$string = "disk = [ file:/path/to/file,sda1,w ]";
$string =~ s/^.+://;
$string =~ s/ ]$//;
($path,$name,$perms) = split(",", $string);


--
      http://fuzzydev.org/~pobega
        http://identi.ca/pobega


Reply to: