in reply to Search and Replace.
Change
s/^[ ]*//g;
s/[ ]*$//g;
to
s/^[ ]+//;
s/[ ]+$//;
to avoid useless substitutions. I also removed the /g since there's only one start of line and one end of line per line (unless /m is also used).
Are you sure you want [A,P]M (which matches "AM", ",M" and "PM") and not [AP]M?
The slash in \:000 is useless, but that won't affect anything (except readability).
The slashes before the ~ characters are useless, but won't affect anything (except readability).
If the file isn't too big to load into memory, you could try doing that.
local $_; # Read entire file into $_. { local $/; $_ = <IN_FILE>; } # Execute substitutions once each. s/^[ ]+//mg; s/[ ]+$//mg; s/ :000[AP]M | 99991231 | Jan\ 1\ 1900\ 12:00:00 //xg; s/[ ]*~\t~[ ]*/~/g; # Output entire file. print;
|
|---|