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

[Omaha.pm] Add a pipe to a pipe delim file




Problem:

You have a pipe delimited file and need to pretend that there's an extra field right after the 9th field.

Solution:

$ cat j.pl
#!/usr/bin/perl

while (<>) {
 my @l = split /\|/;
 $l[8] = "$l[8]|";
 print join "|", @l;
}

I ran it like so:

$ perl j.pl reward_event_ar.unl > reward_event_ar.unl.2

I'm sure there's a shorter solution out there, but that's how I code that solution off the top of my head.

j