Re: Regarding file handling

2007-06-21 Thread Dharshana Eswaran
My outfile should look like this: STACK_CC_SS_COMMON_TYPE_REFERENCE_PROTOCOL_DIS_T => "UINT8", STACK_CC_SS_COMMON_TYPE_REFERENCE_TRANSACTION_ID_T => "UINT8", STACK_CC_SS_COMMON_TYPE_REFERENCE_TRANSACTION_ID_T => "UINT8", STACK_CC_SS_COMMON_TYPE_CHANNEL_TYPE_T => "UINT8", STACK_CC_SS_C

Re: Regarding file handling

2007-06-21 Thread Prabu Ayyappan
Hope this helps you. use strict; use warnings; open my $fh, '<', "infile.txt" or die $!; open my $ofh, '>', "outfile.txt" or die $!; local $/ = "};"; my %printed; my @a = <$fh>; my @b = (); foreach(@a){ if ($_ =~ m/(.*?)\_T\n/){ my $tomatch = $1; my $cnt = grep /$toma

Re: Regarding file handling

2007-06-21 Thread Dharshana Eswaran
Actually my work is from the text file, i need to consider each entry in every structure, and find its data type, to which its typedefed to and then assign the values according to the value of the datatype. For eg: A sample of the text file is shown below: STACK_CC_SS_COMMON_TYPE_REFERENCE_ID_T {

Re: Regarding file handling

2007-06-21 Thread Tom Phoenix
On 6/21/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: I am unable to get the desired result. Its printing all the instances of the block. Please post the smallest self-contained example program which other people can use to see what you're doing, with what data. Ideally, narrow things down

Re: Regarding file handling

2007-06-21 Thread Dharshana Eswaran
On 6/21/07, Paul Lalli <[EMAIL PROTECTED]> wrote: On Jun 21, 9:31 am, [EMAIL PROTECTED] (Dharshana Eswaran) wrote: > Hi All, > > I am reading a certain data from one file and writing to another file. In > the original file, there are few lines, which occur more than once in > different lines. Wh

Re: Regarding file handling

2007-06-21 Thread Paul Lalli
On Jun 21, 9:31 am, [EMAIL PROTECTED] (Dharshana Eswaran) wrote: > Hi All, > > I am reading a certain data from one file and writing to another file. In > the original file, there are few lines, which occur more than once in > different lines. When i am writing it to the second file, i don't want i

Regarding file handling

2007-06-21 Thread Dharshana Eswaran
Hi All, I am reading a certain data from one file and writing to another file. In the original file, there are few lines, which occur more than once in different lines. When i am writing it to the second file, i don't want it to be written more than once. I mean, it should not be repetitive. The