[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Omaha.pm] Add a pipe to a pipe delim file
Sean Baker wrote:
If all you want to do is add a pipe to the end:
perl -pi -e "s/$/|/g" [filename]
Or the beginning:
perl -pi -e "s/^/|/g" [filename]
Ya. To do what I needed (tweak the 9th column, not the last one), perhaps -a or -F would do that in a one liner? I'm not good with those yet.
j
perldoc perlrun
-a turns on autosplit mode when used with a -n or -p. An implicit
split command to the @F array is done as the first thing inside
the implicit while loop produced by the -n or -p.
perl -ane 'print pop(@F), "\n";'
is equivalent to
while (<>) {
@F = split(' ');
print pop(@F), "\n";
}
An alternate delimiter may be specified using -F.