Aditi Gupta wrote:
On 6/23/05, John W. Krahn <[EMAIL PROTECTED]> wrote:
Aditi Gupta wrote:
I have a file as follows:
#block1
aaa
aaa
#block2
bbb
bbb
#block3
ccc
ccc
and i want to append(or i should say merge) these blocks and get a file
like this:
aaabbbccc
aaabbbccc
how can this be
hello everybody,
first of all i'd like to thank all of you for your time and help.. but i'm
still stuck!!
The code which Dave sent:
my @blocks = ();
my $maxlen = 0;
while () {
chomp;
if (/^#/) {
push @blocks, [];
} elsif ($_) {
push @{$blocks[$#blocks]}, $_;
my $len = $#{$blocks[$#blocks]};
$ma
Aditi Gupta wrote:
Hi Perlers,
Hello,
I have a file as follows:
#block1
aaa
aaa
#block2
bbb
bbb
#block3
ccc
ccc
and i want to append(or i should say merge) these blocks and get a file like
this:
aaabbbccc
aaabbbccc
how can this be done using perl?
please help..
$ echo "
aaa
aaa
bb
> and i want to append(or i should say merge) these blocks and get a
> file like this:
> aaabbbccc
> aaabbbccc
I've asked the same question some time ago,
check this out:
http://groups-beta.google.com/group/perl.beginners/browse_thread/thread/4f28012f744d10e0/7638b6eb94a626d2?q=edward+wijaya+g
On 6/22/05, Dan Klose <[EMAIL PROTECTED]> wrote:
>
> > Using a hash of arrays will not necessarily preserve the order...
>
> If you don't want to worry about sorting the order of the blocks i.e.
> doing it yourself then use Tie::IXhash (something like that on CPAN) to
> preserve the order, you th
> Using a hash of arrays will not necessarily preserve the order...
If you don't want to worry about sorting the order of the blocks i.e.
doing it yourself then use Tie::IXhash (something like that on CPAN) to
preserve the order, you then don't have to worry about unbalanced blocks
and reassembly
On 6/22/05, Aditi Gupta <[EMAIL PROTECTED]> wrote:
> Since i'm using activestate perl on windows xp i don't know whether paste
> will work or not.
> I'll try the hash of array.
Using a hash of arrays will not necessarily preserve the order. Below
is the start of an array of arrays solution. I'll l
HI Dan,
Since i'm using activestate perl on windows xp i don't know whether paste
will work or not.
I'll try the hash of array.
Thanks for the help
regards
Aditi.
On 6/22/05, Dan Klose <[EMAIL PROTECTED]> wrote:
>
> If I was doing this I would split the file on the gaps between blocks
> and
Hi all,
I know the terms of the list.. and before this i have always written a code
and asked for a doubt if it doesn't work... but this time i'm not aware of
any way to do the job.. thats why i asked to help me out, I haven't asked
for any code, just hints what can be used. I'm sorry if i gave
If I was doing this I would split the file on the gaps between blocks
and the use the unix paste function to assemble the blocks.
&> paste A B C > D
? using a hash of arrays (HOA) to store each block and then go back over
the HOA each element at a time ... although this is probably overkill?
On
Aditi Gupta wrote:
> Hi Perlers,
>
> I have a file as follows:
>
> #block1
> aaa
> aaa
>
> #block2
> bbb
> bbb
>
> #block3
> ccc
> ccc
>
> and i want to append(or i should say merge) these blocks and get a
> file like this:
>
> aaabbbccc
> aaabbbccc
>
> how can this be done using perl?
> ple
11 matches
Mail list logo