thunder wrote:
Hello all

Hello,

I have the following small file that i am parsing one line at a time
(each line consists of hex values)

line 1: 0d
line 2: 00000000
line 3: 00002000
line 4: 0064
line 5: 76d457ed462df78c7cfde9f9e33724c6
line 6: bded7a7b9f6d763e
line 7: 0059010081bb300597603b6f90ef4421
line 8: 001608427754e957a0d281bb30059760
line 9: a72f731c3be600000000000000000000


For line 5, for example, i want to break it up into chunks of 8 hex
charaters (ie for example 76d457ed, 462df78c etc).

$ echo "0d
00000000
00002000
0064
76d457ed462df78c7cfde9f9e33724c6
bded7a7b9f6d763e
0059010081bb300597603b6f90ef4421
001608427754e957a0d281bb30059760
a72f731c3be600000000000000000000" |\
    perl -lpe'$. == 5 and $_ = join " ", /[[:xdigit:]]{0,8}/g'
0d
00000000
00002000
0064
76d457ed 462df78c 7cfde9f9 e33724c6
bded7a7b9f6d763e
0059010081bb300597603b6f90ef4421
001608427754e957a0d281bb30059760
a72f731c3be600000000000000000000



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to