#!/usr/bin/perl -p
s/^\|/\\N\|/;
s/\|\s*$/\|\\N/;
s/\|\s*\|/\|\\N\|/g;
s/\|\.\s*\|/\|\\N\|/g;
s/\|\s+/\|/g;
s/\s+\|/\|/g;
s/(\d{2}:\d{2}:\d{2})\.\d+/$1/g;
s/(\d{5})-(?:\d{1,4}|\s+)/$1/;
Execute as so:
my_scriptydoo.pl file1 > file2
Update: ikegami is absolutely correct. I should be doing a redirect. The next 1st level response provides the -pi version.
- In general, if you think something isn't in Perl, try it out, because it usually is. :-)
- "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"