in reply to Re: Extracting data from a pipe delimited text file
in thread Extracting data from a pipe delimited text file

And in that vein, the following command should scan through a file and perform the operation on every line, leaving a backup with .bak appended. If this is Windows, change the single quotes to double quotes.

perl -pi.bak -e 's/\s*\|\s*/\|/g' filename