Ken

What exactly are the rules? I wrote this:

    my @file = (
    ' Dec 20 13:28 guard/AFRC_AFRC00_01',
    ' Nov 22 2001 guard/ANCHORAGE_668300_14',
    ' Dec 20 08:46 guard/ALPENA_MI_503000_79',
    ' Dec 30 06:51 guard/ANDREWS_MD_525700_93' );

    @file = map {
        s/\b(?=\s)/|/g;
        s/(?<=\/)/|/g;
        s/(\d\d_)(\d\d)$/|$1|$2/g;
        $_} @file;

    print "$_\n" foreach @file;

which outputs this:

 Dec| 20| 13:28| guard/|AFRC_AFRC|00_|01
 Nov| 22| 2001| guard/|ANCHORAGE_6683|00_|14
 Dec| 20| 08:46| guard/|ALPENA_MI_5030|00_|79
 Dec| 30| 06:51| guard/|ANDREWS_MD_5257|00_|93

which is what you wanted except that the separator doesn't immediately
precede 'guard'.

Rob

"Jensen Kenneth B Sra Afpc/Dpdmpq" <[EMAIL PROTECTED]> wrote in
message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Trying to make a one liner regxp to covert a file. File has lines like
these
> (lines are preceded with a space)
>
>  Dec 20 13:28 guard/AFRC_AFRC00_01
>  Nov 22 2001 guard/ANCHORAGE_668300_14
>  Dec 20 08:46 guard/ALPENA_MI_503000_79
>  Dec 30 06:51 guard/ANDREWS_MD_525700_93
>
> Output needs to look like this with pipelines inserted.
>  Dec| 20| 13:28 |guard/|AFRC_AFRC|00_|01
>  Nov| 22| 2001 |guard/|ANCHORAGE_6683|00_|14
>  Dec| 20| 08:46 |guard/|ALPENA_MI_5030|00_|79
>  Dec| 30| 06:51 |guard/|ANDREWS_MD_5257|00_|93
>
> The regex's I've tried have been pretty far off. Any help in this greatly
> appreciated.
>
> Ken
>



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

Reply via email to