in reply to Repeat match

Your post is not clear to understand.
According to my understanding, your data seems to be like this
jsdlkjalsd same_text = 1, jhhj, jhjk = 256, iuqoi, uereoiu, sjksdh, s +ame_text = 2, lkkj, lksj = 6287 uwie same_text = 2, sdaj, jsdgd, sksd
you want a hash output as
For the key "1" the value should be "jhhj, jhjk" For the key "2" the value should be "lkkj, lksj , sdaj, jsdgd"
If I am correct then you can use the below perl code.
use Data::Dumper; open(FH,"x.txt") or die("Can't open the file: $!"); $/=EOF; my $var = <FH>; my %hash=(); while ($var =~ /(same_text\s=\s\d),((\s\S+){1,2})/gi) { my ($junk,$ky)=split(/=/,$1); push(@{$hash{$ky}},$2); } map { print "$_ -- @{$hash{$_}} \n "; } keys %hash;

Replies are listed 'Best First'.
Re^2: Repeat match
by Anonymous Monk on Jan 30, 2007 at 13:16 UTC
    Thanks..Siva Kumar... works now!!!