Ask a Question related to PERL Beginners, Design and Development.
-
Jeff 'Japhy' Pinyan #1
Re: get rid of whitespace around pipes??
On Dec 17, LoneWolf said:
Then split on /\s*\|\s*/. That regex reads "zero or more whitespace, a |,>I am parsing a massive file line by line and cleaning it up. It has about
>15 fields, all separated by | and I want to remove the white space from
>before and after the pipes so that as the information is parsed it gets rid
>of external white spaces from the string and such.
then zero or more whitespace".
@fields = split /\s*\|\s*/, $line;
--
Jeff "japhy" Pinyan [email]japhy@pobox.com[/email] [url]http://www.pobox.com/~japhy/[/url]
RPI Acacia brother #734 [url]http://www.perlmonks.org/[/url] [url]http://www.cpan.org/[/url]
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
Jeff 'Japhy' Pinyan Guest
-
Bidirectional pipes
Hi all, I wonder how can I open pipe to STDIN and STDOUT of a process ? Tnx. Mehmet -
How do I set up bidirectional pipes over a network connection?
I have 2 Linux boxes I want to talk to each other over the local network using a Perl script. Is it possible to set up a bidirectional pipe so... -
problem connecting pipes in Expect.pm
Here is a script I'm working on to connect to various lpars that are connected to my local HMC. The script creates the proper magic string and is... -
bi-directional IPC / pipes / when to close??
Hi, I'm writing a C program that needs to bi-directionally communicate with with a forked/execvp'd process. Here is a sample program that... -
Hanging pipes in CGI Perl
Christophe Baegert wrote: .... h--^ *please* copy/paste working code, don't just type it in!!! -
Randy W. Sims #2
Re: get rid of whitespace around pipes??
On 12/17/2003 11:26 AM, LoneWolf wrote:
my @fields = split /\s*\|\s*/, $line;> I am parsing a massive file line by line and cleaning it up. It has about
> 15 fields, all separated by | and I want to remove the white space from
> before and after the pipes so that as the information is parsed it gets rid
> of external white spaces from the string and such.
>
> Some fields are numbers, others are strings, and a couple are arrays.
>
> sample:
> 1|AA-1202 |12in. X10.75 FOIL SHEETS 12/200| 70.96 | 46.40 | 45.24 | 44.13
> |246|3| 55.000 | .000 | .000 |A |AA-1202
> 2| AA-1205 |12in. x10in. FOIL POPUP SHEETS 6/500| 96.61 | 63.17 | 61.59 |
> 60.09 |246|3| 25.000 | 6.000 | .000 |B | AA-1205
Randy W. Sims Guest
-
James Edward Gray II #3
Re: get rid of whitespace around pipes??
On Dec 17, 2003, at 10:26 AM, LoneWolf wrote:
Try something like:> I am parsing a massive file line by line and cleaning it up. It has
> about
> 15 fields, all separated by | and I want to remove the white space from
> before and after the pipes so that as the information is parsed it
> gets rid
> of external white spaces from the string and such.
my @fields = split /\s*\|\s*/, $line;
Good luck.
James
James Edward Gray II Guest
-
Lonewolf #4
get rid of whitespace around pipes??
I am parsing a massive file line by line and cleaning it up. It has about
15 fields, all separated by | and I want to remove the white space from
before and after the pipes so that as the information is parsed it gets rid
of external white spaces from the string and such.
Some fields are numbers, others are strings, and a couple are arrays.
sample:
1|AA-1202 |12in. X10.75 FOIL SHEETS 12/200| 70.96 | 46.40 | 45.24 | 44.13
|246|3| 55.000 | .000 | .000 |A |AA-1202
2| AA-1205 |12in. x10in. FOIL POPUP SHEETS 6/500| 96.61 | 63.17 | 61.59 |
60.09 |246|3| 25.000 | 6.000 | .000 |B | AA-1205
TIA!!
Robert
Lonewolf Guest



Reply With Quote

