gagajanice
asked on
how to generate the variable from string with pipe?
How to print the each value in the PIPE?
I got the string like this ->>>>
AAA="|382200000 |0 | |2.30 |KG | | |3893.00 | | | | |
| | | | | | | |
|300210000 |6 | |2.60 |KG | | |3948.00 | | | | |
| | | | | | | |
(2 rows affected)
(return status = 0)"
i need to print it
382200000 ^M
0 ^M
^M
2.30 ^M
KG ^M
until last one
^M
any idea for this?
I got the string like this ->>>>
AAA="|382200000 |0 | |2.30 |KG | | |3893.00 | | | | |
| | | | | | | |
|300210000 |6 | |2.60 |KG | | |3948.00 | | | | |
| | | | | | | |
(2 rows affected)
(return status = 0)"
i need to print it
382200000 ^M
0 ^M
^M
2.30 ^M
KG ^M
until last one
^M
any idea for this?
ASKER
thankx.. i need the bash script one... do u know?
Improved version:
$AAA=q{|382200000 |0 | |2.30 |KG | | |3893.00 | | | | | | | | | | | | |
|300210000 |6 | |2.60 |KG | | |3948.00 | | | | | | | | | | | | |
(2 rows affected)
(return status = 0)"
};
@a = split(/[\r\n]+/, $AAA);
foreach $a (@a) { while ( $a =~ s/^\|([^\|]*)\|/\|/ ) { print "$1^M\n"; } }
Sorry, not a basher.
ASKER
oic... thank you so much!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
Open in new window