file handling

--001485f63082587ae3047f4d93c7
Content-Type: multipart/alternative; boundary=001485f63082587adb047f4d93c5

--001485f63082587adb047f4d93c5
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I have a program which reads the input file,updates once and outputs in a
new file.
Ex.The first line L1 will be updated to L2.
I need to put this into a loop so that the scripts will be invoked 1000
times and the
output contains the appended data(L1 TO L1000).
Please can you suggest few methods.

Thanks.
neelike.

--001485f63082587adb047f4d93c5
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Hi,</div>
<div><br>=A0I have a program which reads the input file,updates once and ou=
tputs in a new file.<br>Ex.The first line L1 will be updated to L2.<br>I ne=
ed to put this into a loop so that the scripts will be invoked 1000 times a=
nd the <br>
output contains the appended data(L1 TO L1000).<br>Please can you suggest f=
ew methods.</div>
<div>=A0</div>
<div>Thanks.</div>
<div>neelike.</div>

--001485f63082587adb047f4d93c5--
--001485f63082587ae3047f4d93c7
Content-Type: text/plain; charset=US-ASCII; name=1200
Content-Disposition: attachment; filename=1200
Content-Transfer-Encoding: base64
X-Attachment-Id: f_g5j3px1t

ICAgICA8RmllbGQgSUQ9IjIwMDAwIj4NCiAgICAgICA8QXR0clNldCBJRD0i Q29yZSI+DQogICAg
ICAgIDxpbnRlZ2VyIElEPSJab25lSWQiIFZhbHVlPSI5OTkiIC8+DQogICAg ICAgIDxzdHJpbmcg
SUQ9Ik5hbWUiIFZhbHVlPSI0Ml9MMV9WYWxpZF9MaW5lX0luZGljYXRvcl8y MDAwMCIgLz4NCiAg
ICAgICAgPGJvb2xlYW4gSUQ9IkxpbmtlZENvb3JkIiBWYWx1ZT0iZmFsc2Ui IC8+DQogICAgICAg
IDxpbnRlZ2VyIElEPSJUeXBlIiBWYWx1ZT0iMyIgLz4NCiAgICAgICAgPGlu dGVnZXIgSUQ9Ingi
IFZhbHVlPSIwIiAvPg0KICAgICAgICA8aW50ZWdlciBJRD0ieSIgVmFsdWU9 IjAiIC8+DQogICAg
ICAgIDxp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AgPC9GaWVsZD4=
--001485f63082587ae3047f4d93c7
Content-Type: application/octet-stream; name="Converter.pl"
Content-Disposition: attachment; filename="Converter.pl"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_g5j6fiut

IyEgYzovcGVybC9iaW4vcGVybA0KDQp1c2Ugc3RyaWN0Ow0KDQpteSAkZmls ZSA9IHNoaWZ0Ow0K
bXkgJG9sZCA9ICRmaWxlOw0KbXkgJG5ldyA9ICIkZmlsZS50bXAuJCQiOw0K bXkgJGJhayA9ICIk
ZmlsZS5iYWsiOw0KDQojRmlsZSBIYW5kbGluZw0Kb3BlbihPTEQsICI8ICRv bGQiKSAgICAgICAg
IG9yIGRpZSAiY2FuJ3Qgb3BlbiAkb2xkOiAkISI7DQpvcGVuKE5FVywgIj4g JG5ldyIpICAgICAg
ICAgb3IgZGllICJjYW4ndCBvcGVuICRuZXc6ICQhIjsNCg0KIyBDb3JyZWN0 IHR5cG9zLCBwcmVz
ZXJ2aW5nIGNhc2UNCiAgICB3aGlsZSAoPE9MRD4pIHsNCiNDb25kaXRpb24g dG8gbWF0Y2ggdGhl
IEZpZWxkIElEIGFuZCBpbmNyZW1hbmV0IGJ5IDIwLg0KIzxGaWVsZCBJRD0i MjMxMjAiPg0KaWYo
JF8gPX4gL1w8RmllbGQoLiopXCIoLiopXCJcPi8pDQp7DQpteSAkdmFsPSAk MjsNCm15ICRuZXd2
YWw9JHZhbCsyMDsNCiRfID1+IHMvJHZhbC8kbmV3dmFsLzsNCnByaW50ICJP TEQ6JHZhbCBcdCBO
RVc6JG5ld3ZhbFxuIiA7IA0KfQkgDQoNCiNDb25kaXRpb24gdG8gbWF0Y2gg dGhlIGxpbmUgYW5k
IGluY3JlYW1lbnQgYnkgMS4NCiMgPHN0cmluZyBJRD0iTmFtZSIgVmFsdWU9 IjI0R19MMjRfVW5p
dHNRdWFsaWZpZXJfMjEyMyIgLz4NCmlmICgkXyA9fiAvKExcZHsyLDN9KVxf L2cpIA0KICB7DQog
bXkgJGxpbmUgPSAkMTsNCmlmKCRsaW5lID1+IC8oXGQrKS9nKQ0Kew0KCW15 ICRuX2xpbmUgPSAk
MTsNCglteSAkbmV3bGluZSA9ICRuX2xpbmUrMTsNCgkkXz1+IHMvJGxpbmUv TCRuZXdsaW5lLzsN
CglwcmludCAiT0xEOiRsaW5lIFx0IE5FVzpMJG5ld2xpbmVcbiIgOw0KfQ0K DQogfQ0KICNDb25k
aXRpb24gdG8gaW5jcmVtZW50IHRoZSBmaW5hbCBzZWdtZW50IGluIHRoZSBh Ym92ZSBzdHJpbmcN
CiAgaWYoJF89fiAvXDxzdHJpbmcoLiopTChcZCspKC4qKVxfKFxkKylcIi8p DQogew0KIG15ICR2
YWx1ZT0kNDsNCiBteSAkbmV3dmFsdWU9JHZhbHVlKzIwOw0KICRfPX4gcy8k dmFsdWUvJG5ld3Zh
bHVlLzsNCiBwcmludCAiT0xEOiR2YWx1ZSBcdCBORVc6JG5ld3ZhbHVlXG4i IDsgDQogfQ0KIA0K
CQkocHJpbnQgTkVXICRfKSAgICAgICAgICBvciBkaWUgImNhbid0IHdyaXRl IHRvICRuZXc6ICQh
IjsNCiAgICANCn0NCg0KICAgIGNsb3NlKE9MRCkgICAgICAgICAgICAgICAg ICBvciBkaWUgImNh
bid0IGNsb3NlICRvbGQ6ICQhIjsNCiAgICBjbG9zZShORVcpICAgICAgICAg ICAgICAgICAgb3Ig
ZGllICJjYW4ndCBjbG9zZSAkbmV3OiAkISI7DQogICAgcmVuYW1lKCRvbGQs ICRiYWspICAgICAg
ICAgIG9yIGRpZSAiY2FuJ3QgcmVuYW1lICRvbGQgdG8gJGJhazogJCEiOw0K ICAgIHJlbmFtZSgk
bmV3LCAkb2xkKSAgICAgICAgICBvciBkaWUgImNhbid0IHJlbmFtZSAkbmV3 IHRvICRvbGQ6ICQh
IjsNCg0K

--001485f63082587ae3047f4d93c7
Content-Type: text/plain; charset=us-ascii

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/

--001485f63082587ae3047f4d93c7--
elavazhagan perl [ Do, 11 Februar 2010 07:51 ] [ ID #2032091 ]

Re: file handling

elavazhagan perl wrote:
> Hi,

Hello,

> I have a program which reads the input file,updates once and outputs in a
> new file.
> Ex.The first line L1 will be updated to L2.
> I need to put this into a loop so that the scripts will be invoked 1000
> times and the output contains the appended data(L1 TO L1000).
> Please can you suggest few methods.

It is not clear from your description or from your code exactly what you
want to do. Do you want 1,000 separate files or one file with the data
replicated 1,000 times or something else?

Anyway, let's have a look at the code:

[ Note that you should indent your code consistently to aide in
readability. ]

> #! c:/perl/bin/perl
>
> use strict;
>
> my $file = shift;
> my $old = $file;
> my $new = "$file.tmp.$$";
> my $bak = "$file.bak";
>
> #File Handling
> open(OLD, "< $old") or die "can't open $old: $!";
> open(NEW, "> $new") or die "can't open $new: $!";
>
> # Correct typos, preserving case
> while (<OLD>) {
> #Condition to match the Field ID and incremanet by 20.
> #<Field ID="23120">
> if($_ =~ /\<Field(.*)\"(.*)\"\>/)

Why are you capturing to $1 when you are not using it?

> {
> my $val= $2;
> my $newval=$val+20;
> $_ =~ s/$val/$newval/;

You shouldn't do that. See below for explanation.

> print "OLD:$val \t NEW:$newval\n" ;
> }
>
> #Condition to match the line and increament by 1.
> # <string ID="Name" Value="24G_L24_UnitsQualifier_2123" />
> if ($_ =~ /(L\d{2,3})\_/g)

Why are you using the /g global option if the pattern only occurs once
in the string? The data you supplied does not match the pattern
/(L\d{2,3})_/ so is the data wrong or the pattern wrong or something else?

> {
> my $line = $1;
> if($line =~ /(\d+)/g)

Why are you matching \d again when you already know that \d exists in
the string? Why are you using the /g global option if the pattern only
occurs once in the string?

> {
> my $n_line = $1;
> my $newline = $n_line+1;
> $_=~ s/$line/L$newline/;

You *really* shouldn't do that.

> print "OLD:$line \t NEW:L$newline\n" ;
> }
>
> }
> #Condition to increment the final segment in the above string
> if($_=~ /\<string(.*)L(\d+)(.*)\_(\d+)\"/)

Why are you capturing to $1, $2 and $3 when you are not using them?

> {
> my $value=$4;
> my $newvalue=$value+20;
> $_=~ s/$value/$newvalue/;

You are running a pattern match using a string (in this case $value)
that may occur anywhere in the string, not just the place where you
originally found it, and may contain regular expression meta-characters
that could cause the pattern to fail.

> print "OLD:$value \t NEW:$newvalue\n" ;
> }
>
> (print NEW $_) or die "can't write to $new: $!";
>
> }
>
> close(OLD) or die "can't close $old: $!";
> close(NEW) or die "can't close $new: $!";
> rename($old, $bak) or die "can't rename $old to $bak: $!";
> rename($new, $old) or die "can't rename $new to $old: $!";


Your while loop would probably be better written as:

# Correct typos, preserving case
while ( <OLD> ) {
#Condition to match the Field ID and incremanet by 20.
#<Field ID="23120">
if ( s/(<Field.*")(\d+)">/ $1 . ( $2 + 20 ) . '">' /e )
{
print "OLD:$2 \t NEW:", $2 + 20, "\n";
}

#Condition to match the line and increament by 1.
# <string ID="Name" Value="24G_L24_UnitsQualifier_2123" />
if ( s/_L(\d{2,3})_/ '_L' . ( $1 + 1 ) . '_' /e )
{
print "OLD:L$1 \t NEW:L", $1 + 1, "\n";
}

#Condition to increment the final segment in the above string
if ( s/(<string.*L\d+.*_)(\d+)"/ $1 . ( $2 + 20 ) . '"' /e )
{
print "OLD:$2 \t NEW:", $2 + 20, "\n";
}

print NEW $_ or die "can't write to $new: $!";
}





John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
jwkrahn [ Do, 11 Februar 2010 12:35 ] [ ID #2032093 ]

Re: file handling

elavazhagan perl wrote:
> On 2/11/10, John W. Krahn <jwkrahn [at] shaw.ca> wrote:
>>
>> elavazhagan perl wrote:
>>>
>>> I have a program which reads the input file,updates once and outputs in
>>> a new file.
>>> Ex.The first line L1 will be updated to L2.
>>> I need to put this into a loop so that the scripts will be invoked 1000
>>> times and the output contains the appended data(L1 TO L1000).
>>> Please can you suggest few methods.
>>>
>> It is not clear from your description or from your code exactly what you
>> want to do. Do you want 1,000 separate files or one file with the data
>> replicated 1,000 times or something else?
>
> I will try my best to make you clear.
> Once we execute the script,it should generate the data for the 1000
> lines.Now the script just converts the data for a single line

The data you provided has 156 "lines" in it. Do you consider all that
data to be just one "line"?

> i.e Line1 will
> be converted to line 2 and some increaments.
> In order to get my desired data,I need to execute the script 1000 times,and
> each output will be appended in a new file which will contain the whole
> data.
> I am trying to update the script so that for a single execution,it will
> produce the whole data.
> Hope I make it clear.Please let me know if any ambiguityon this.

What you want sounds easy enough to do. If you could just clear up what
you mean by "line"?



John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
jwkrahn [ Fr, 12 Februar 2010 08:43 ] [ ID #2032165 ]

Re: file handling

--001485f4547800c167047f63f224
Content-Type: text/plain; charset=ISO-8859-1

Hope,this time I will make you clear.

Our script converts the original content to current output ,what we need is
the desired output.

*ORIGINAL CONTENT:*
<Field ID="*20000*">
<AttrSet ID="Core">
<integer ID="ZoneId" Value="999" />
<string ID="Name" Value="42_*L1*_Valid_Line_Indicator_*20000*" />
<boolean ID="LinkedCoord" Value="false" />
<integer ID="Type" Value="3" />
<integer ID="x" Value="0" />
<integer ID="y" Value="0" />
<integer ID="w" Value="10" />
<integer ID="h" Value="10" />
</AttrSet>
</Field>

*CURRENT OUTPUT:*

<Field ID="*20020*">
<AttrSet ID="Core">
<integer ID="ZoneId" Value="999" />
<string ID="Name" Value="42_*L2*_Valid_Line_Indicator_*20020*" />
<boolean ID="LinkedCoord" Value="false" />
<integer ID="Type" Value="3" />
<integer ID="x" Value="0" />
<integer ID="y" Value="0" />
<integer ID="w" Value="10" />
<integer ID="h" Value="10" />
</AttrSet>
</Field>

*DESIRED OUTPUT:*

<Field ID="*20980*">
<AttrSet ID="Core">
<integer ID="ZoneId" Value="999" />
<string ID="Name" Value="42_*L1000*_Valid_Line_Indicator_*20980*" />
<boolean ID="LinkedCoord" Value="false" />
<integer ID="Type" Value="3" />
<integer ID="x" Value="0" />
<integer ID="y" Value="0" />
<integer ID="w" Value="10" />
<integer ID="h" Value="10" />
</AttrSet>
</Field>


Thanks.....


On 2/12/10, John W. Krahn <jwkrahn [at] shaw.ca> wrote:
>
> elavazhagan perl wrote:
>
>> On 2/11/10, John W. Krahn <jwkrahn [at] shaw.ca> wrote:
>>
>>>
>>> elavazhagan perl wrote:
>>>
>>>>
>>>> I have a program which reads the input file,updates once and outputs in
>>>> a new file.
>>>> Ex.The first line L1 will be updated to L2.
>>>> I need to put this into a loop so that the scripts will be invoked 1000
>>>> times and the output contains the appended data(L1 TO L1000).
>>>> Please can you suggest few methods.
>>>>
>>>> It is not clear from your description or from your code exactly what you
>>> want to do. Do you want 1,000 separate files or one file with the data
>>> replicated 1,000 times or something else?
>>>
>>
>> I will try my best to make you clear.
>> Once we execute the script,it should generate the data for the 1000
>> lines.Now the script just converts the data for a single line
>>
>
> The data you provided has 156 "lines" in it. Do you consider all that data
> to be just one "line"?
>
> i.e Line1 will
>> be converted to line 2 and some increaments.
>> In order to get my desired data,I need to execute the script 1000
>> times,and
>> each output will be appended in a new file which will contain the whole
>> data.
>> I am trying to update the script so that for a single execution,it will
>> produce the whole data.
>> Hope I make it clear.Please let me know if any ambiguityon this.
>>
>
> What you want sounds easy enough to do. If you could just clear up what
> you mean by "line"?
>
>
>
>
> John
> --
> The programmer is fighting against the two most
> destructive forces in the universe: entropy and
> human stupidity. -- Damian Conway
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
> For additional commands, e-mail: beginners-help [at] perl.org
> http://learn.perl.org/
>
>
>

--001485f4547800c167047f63f224--
elavazhagan perl [ Fr, 12 Februar 2010 10:32 ] [ ID #2032166 ]

Fwd: file handling

--001485f64b44b5b895047f642d78
Content-Type: text/plain; charset=ISO-8859-1

Hi,

Please find the correction in my words.
The script should read the original content and update and append the data
to a new file upto the desired output.

Thanks.

---------- Forwarded message ----------
From: elavazhagan perl <elavazhagan.perl [at] gmail.com>
Date: Feb 12, 2010 3:02 PM
Subject: Re: file handling
To: "John W. Krahn" <jwkrahn [at] shaw.ca>
Cc: beginners [at] perl.org



Hope,this time I will make you clear.

Our script converts the original content to current output ,what we need is
the desired output.

*ORIGINAL CONTENT:*
<Field ID="*20000*">
<AttrSet ID="Core">
<integer ID="ZoneId" Value="999" />
<string ID="Name" Value="42_*L1*_Valid_Line_Indicator_*20000*" />
<boolean ID="LinkedCoord" Value="false" />
<integer ID="Type" Value="3" />
<integer ID="x" Value="0" />
<integer ID="y" Value="0" />
<integer ID="w" Value="10" />
<integer ID="h" Value="10" />
</AttrSet>
</Field>

*CURRENT OUTPUT:*

<Field ID="*20020*">
<AttrSet ID="Core">
<integer ID="ZoneId" Value="999" />
<string ID="Name" Value="42_*L2*_Valid_Line_Indicator_*20020*" />
<boolean ID="LinkedCoord" Value="false" />
<integer ID="Type" Value="3" />
<integer ID="x" Value="0" />
<integer ID="y" Value="0" />
<integer ID="w" Value="10" />
<integer ID="h" Value="10" />
</AttrSet>
</Field>

*DESIRED OUTPUT:*

<Field ID="*20980*">
<AttrSet ID="Core">
<integer ID="ZoneId" Value="999" />
<string ID="Name" Value="42_*L1000*_Valid_Line_Indicator_*20980*" />
<boolean ID="LinkedCoord" Value="false" />
<integer ID="Type" Value="3" />
<integer ID="x" Value="0" />
<integer ID="y" Value="0" />
<integer ID="w" Value="10" />
<integer ID="h" Value="10" />
</AttrSet>
</Field>


Thanks.....


On 2/12/10, John W. Krahn <jwkrahn [at] shaw.ca> wrote:
>
> elavazhagan perl wrote:
>
>> On 2/11/10, John W. Krahn <jwkrahn [at] shaw.ca> wrote:
>>
>>>
>>> elavazhagan perl wrote:
>>>
>>>>
>>>> I have a program which reads the input file,updates once and outputs in
>>>> a new file.
>>>> Ex.The first line L1 will be updated to L2.
>>>> I need to put this into a loop so that the scripts will be invoked 1000
>>>> times and the output contains the appended data(L1 TO L1000).
>>>> Please can you suggest few methods.
>>>>
>>>> It is not clear from your description or from your code exactly what you
>>> want to do. Do you want 1,000 separate files or one file with the data
>>> replicated 1,000 times or something else?
>>>
>>
>> I will try my best to make you clear.
>> Once we execute the script,it should generate the data for the 1000
>> lines.Now the script just converts the data for a single line
>>
>
> The data you provided has 156 "lines" in it. Do you consider all that data
> to be just one "line"?
>
> i.e Line1 will
>> be converted to line 2 and some increaments.
>> In order to get my desired data,I need to execute the script 1000
>> times,and
>> each output will be appended in a new file which will contain the whole
>> data.
>> I am trying to update the script so that for a single execution,it will
>> produce the whole data.
>> Hope I make it clear.Please let me know if any ambiguityon this.
>>
>
> What you want sounds easy enough to do. If you could just clear up what
> you mean by "line"?
>
>
>
>
> John
> --
> The programmer is fighting against the two most
> destructive forces in the universe: entropy and
> human stupidity. -- Damian Conway
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
> For additional commands, e-mail: beginners-help [at] perl.org
> http://learn.perl.org/
>
>
>

--001485f64b44b5b895047f642d78--
elavazhagan perl [ Fr, 12 Februar 2010 10:49 ] [ ID #2032167 ]

Re: file handling

elavazhagan perl wrote:
> Hope,this time I will make you clear.
>
> Our script converts the original content to current output ,what we need is
> the desired output.

So I take it by "line" you actually mean "Field record"?


> *ORIGINAL CONTENT:*
> <Field ID="*20000*">
> <AttrSet ID="Core">
> <integer ID="ZoneId" Value="999" />
> <string ID="Name" Value="42_*L1*_Valid_Line_Indicator_*20000*" />
> <boolean ID="LinkedCoord" Value="false" />
> <integer ID="Type" Value="3" />
> <integer ID="x" Value="0" />
> <integer ID="y" Value="0" />
> <integer ID="w" Value="10" />
> <integer ID="h" Value="10" />
> </AttrSet>
> </Field>
>
> *CURRENT OUTPUT:*
>
> <Field ID="*20020*">
> <AttrSet ID="Core">
> <integer ID="ZoneId" Value="999" />
> <string ID="Name" Value="42_*L2*_Valid_Line_Indicator_*20020*" />
> <boolean ID="LinkedCoord" Value="false" />
> <integer ID="Type" Value="3" />
> <integer ID="x" Value="0" />
> <integer ID="y" Value="0" />
> <integer ID="w" Value="10" />
> <integer ID="h" Value="10" />
> </AttrSet>
> </Field>
>
> *DESIRED OUTPUT:*
>
> <Field ID="*20980*">
> <AttrSet ID="Core">
> <integer ID="ZoneId" Value="999" />
> <string ID="Name" Value="42_*L1000*_Valid_Line_Indicator_*20980*" />
> <boolean ID="LinkedCoord" Value="false" />
> <integer ID="Type" Value="3" />
> <integer ID="x" Value="0" />
> <integer ID="y" Value="0" />
> <integer ID="w" Value="10" />
> <integer ID="h" Value="10" />
> </AttrSet>
> </Field>

The original 'Field ID' starts out at 20000 and ends up at 20980. If
you increment that by 20 each time then that is 49 changes to 'Field
ID'. The 'string ID' value starts out at 1 and ends up at 1000 which is
999 changes. If both values are changed at the same time then they
should both have the same number of changes. So how do you determine
when to change one value and not the other?



John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
jwkrahn [ Fr, 12 Februar 2010 11:47 ] [ ID #2032168 ]

Re: file handling

--001485f726d8e98320047f65f482
Content-Type: text/plain; charset=ISO-8859-1

Yes, you are absolutely right..
We need to increment the line by one and field ID by 20.
Whatever my be the fied id..
Thanks,

On 2/12/10, John W. Krahn <jwkrahn [at] shaw.ca> wrote:
>
> elavazhagan perl wrote:
>
>> Hope,this time I will make you clear.
>>
>> Our script converts the original content to current output ,what we need
>> is
>> the desired output.
>>
>
> So I take it by "line" you actually mean "Field record"?
>
>
> *ORIGINAL CONTENT:*
>>
>> <Field ID="*20000*">
>> <AttrSet ID="Core">
>> <integer ID="ZoneId" Value="999" />
>> <string ID="Name" Value="42_*L1*_Valid_Line_Indicator_*20000*" />
>> <boolean ID="LinkedCoord" Value="false" />
>> <integer ID="Type" Value="3" />
>> <integer ID="x" Value="0" />
>> <integer ID="y" Value="0" />
>> <integer ID="w" Value="10" />
>> <integer ID="h" Value="10" />
>> </AttrSet>
>> </Field>
>>
>> *CURRENT OUTPUT:*
>>
>> <Field ID="*20020*">
>> <AttrSet ID="Core">
>> <integer ID="ZoneId" Value="999" />
>> <string ID="Name" Value="42_*L2*_Valid_Line_Indicator_*20020*" />
>> <boolean ID="LinkedCoord" Value="false" />
>> <integer ID="Type" Value="3" />
>> <integer ID="x" Value="0" />
>> <integer ID="y" Value="0" />
>> <integer ID="w" Value="10" />
>> <integer ID="h" Value="10" />
>> </AttrSet>
>> </Field>
>>
>> *DESIRED OUTPUT:*
>>
>> <Field ID="*20980*">
>> <AttrSet ID="Core">
>> <integer ID="ZoneId" Value="999" />
>> <string ID="Name" Value="42_*L1000*_Valid_Line_Indicator_*20980*"
>> />
>> <boolean ID="LinkedCoord" Value="false" />
>> <integer ID="Type" Value="3" />
>> <integer ID="x" Value="0" />
>> <integer ID="y" Value="0" />
>> <integer ID="w" Value="10" />
>> <integer ID="h" Value="10" />
>> </AttrSet>
>> </Field>
>>
>
> The original 'Field ID' starts out at 20000 and ends up at 20980. If you
> increment that by 20 each time then that is 49 changes to 'Field ID'. The
> 'string ID' value starts out at 1 and ends up at 1000 which is 999 changes.
> If both values are changed at the same time then they should both have the
> same number of changes. So how do you determine when to change one value
> and not the other?
>
>
>
>
> John
> --
> The programmer is fighting against the two most
> destructive forces in the universe: entropy and
> human stupidity. -- Damian Conway
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
> For additional commands, e-mail: beginners-help [at] perl.org
> http://learn.perl.org/
>
>
>

--001485f726d8e98320047f65f482--
elavazhagan perl [ Fr, 12 Februar 2010 12:56 ] [ ID #2032169 ]

Re: file handling

elavazhagan perl wrote:
> Yes, you are absolutely right..
> We need to increment the line by one and field ID by 20.
> Whatever my be the fied id..
> Thanks,

OK, I give up. Does anyone else want to try eliciting a cogent and
informative response?


John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
jwkrahn [ Fr, 12 Februar 2010 14:30 ] [ ID #2032170 ]

Re: file handling

--000e0cd4c9e24399b8047f67bfab
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Feb 12, 2010 at 3:32 AM, elavazhagan perl <
elavazhagan.perl [at] gmail.com> wrote:

> *ORIGINAL CONTENT:*
> <Field ID="*20000*">
> <AttrSet ID="Core">
> <integer ID="ZoneId" Value="999" />
> <string ID="Name" Value="42_*L1*_Valid_Line_Indicator_*20000*" />
> <boolean ID="LinkedCoord" Value="false" />
> <integer ID="Type" Value="3" />
> <integer ID="x" Value="0" />
> <integer ID="y" Value="0" />
> <integer ID="w" Value="10" />
> <integer ID="h" Value="10" />
> </AttrSet>
> </Field>
>
> *DESIRED OUTPUT:*
>
> <Field ID="*20980*">
> <AttrSet ID="Core">
> <integer ID="ZoneId" Value="999" />
> <string ID="Name" Value="42_*L1000*_Valid_Line_Indicator_*20980*" />
> <boolean ID="LinkedCoord" Value="false" />
> <integer ID="Type" Value="3" />
> <integer ID="x" Value="0" />
> <integer ID="y" Value="0" />
> <integer ID="w" Value="10" />
> <integer ID="h" Value="10" />
> </AttrSet>
> </Field>
>

In summary, you want to...

1. Read an entire file into one string.
2. Using a regular expression, get the current value of "Field ID".
3. Loop from 2 to 1000...
1. Increment "Field ID" by 20.
2. Substitute the new "Field ID" for the old one, using regular
expressions.
3. Substitute the counter (Lxxxx) in the <string ID="Name"> field.
4. Write the entire block out to a new file.

Is that accurate?

--
Robert Wohlfarth

--000e0cd4c9e24399b8047f67bfab--
Robert Wohlfarth [ Fr, 12 Februar 2010 15:04 ] [ ID #2032171 ]

Re: file handling

--0016363b9f001c8d87047ff2ecbf
Content-Type: text/plain; charset=ISO-8859-1

Guys,

Here I come with the code for the dynamic file update.
Please let me know your comments and concerns with this code.
Thanks for your support and comments.

#################################

#! c:/perl/bin/perl
use File::Copy;

my $file = shift;
my $old = $file;
my $new = "$file.tmp.$$";
my $bak = "$file.bak";

copy($old, $new) or die "can't copy the file:$!";
open(OLD, "< $old") or die "can't open $old: $!";
open(NEW, ">> $new") or die "can't open $new: $!";
print "new file ",$new,"\n\n";

$count=1000;

# Correct typos, preserving case
for($i=1;$i<=$count;$i++) {

seek(OLD,0,0);
while ( <OLD> ) {

#Condition to match the Field ID and incremanet by 20.
#<Field ID="23120">
if ( s/(<Field.*")(\d+)">/ $1 . ( $2 + ($i*20) ) . '">' /e )
{
print "OLD:$2 \t NEW:", $2 + ($i*20), "\n";
}

#Condition to match the line and increament by 1.
# <string ID="Name" Value="24G_L24_UnitsQualifier_2123" />
if ( s/_L(\d{1,3})_/ '_L' . ( $1 + ($i*1) ) . '_' /e )
{
print "OLD:L$1 \t NEW:L", $1 + ($i*1), "\n";
}

#Condition to increment the final segment in the above string
if ( s/(<string.*L\d+.*_)(\d+)"/ $1 . ( $2 + ($i*20) ) . '"' /e )
{
print "OLD:$2 \t NEW:", $2 + ($i*20), "\n";
}

print NEW $_ or die "can't write to $new: $!";

}
print NEW "\n";


}

close(OLD) or die "can't close $old: $!";
close(NEW) or die "can't close $new: $!";


rename($old, $bak) or die "can't rename $old to $bak: $!";
rename($new, $old) or die "can't rename $new to $old: $!";



#################################################

THANKS.



On 2/12/10, Robert Wohlfarth <rbwohlfarth [at] gmail.com> wrote:
>
> On Fri, Feb 12, 2010 at 3:32 AM, elavazhagan perl <
> elavazhagan.perl [at] gmail.com> wrote:
>
>> *ORIGINAL CONTENT:*
>> <Field ID="*20000*">
>> <AttrSet ID="Core">
>> <integer ID="ZoneId" Value="999" />
>> <string ID="Name" Value="42_*L1*_Valid_Line_Indicator_*20000*" />
>> <boolean ID="LinkedCoord" Value="false" />
>> <integer ID="Type" Value="3" />
>> <integer ID="x" Value="0" />
>> <integer ID="y" Value="0" />
>> <integer ID="w" Value="10" />
>> <integer ID="h" Value="10" />
>> </AttrSet>
>> </Field>
>>
>> *DESIRED OUTPUT:*
>>
>> <Field ID="*20980*">
>> <AttrSet ID="Core">
>> <integer ID="ZoneId" Value="999" />
>> <string ID="Name" Value="42_*L1000*_Valid_Line_Indicator_*20980*"
>> />
>> <boolean ID="LinkedCoord" Value="false" />
>> <integer ID="Type" Value="3" />
>> <integer ID="x" Value="0" />
>> <integer ID="y" Value="0" />
>> <integer ID="w" Value="10" />
>> <integer ID="h" Value="10" />
>> </AttrSet>
>> </Field>
>>
>
> In summary, you want to...
>
> 1. Read an entire file into one string.
> 2. Using a regular expression, get the current value of "Field ID".
> 3. Loop from 2 to 1000...
> 1. Increment "Field ID" by 20.
> 2. Substitute the new "Field ID" for the old one, using regular
> expressions.
> 3. Substitute the counter (Lxxxx) in the <string ID="Name"> field.
> 4. Write the entire block out to a new file.
>
> Is that accurate?
>
> --
> Robert Wohlfarth
>
>

--0016363b9f001c8d87047ff2ecbf--
elavazhagan perl [ Fr, 19 Februar 2010 13:07 ] [ ID #2032856 ]

Shorthand for binary bitwise math?

I know I can do this:

$bitvalue=$bitvalue|32

but is there a shorthand for this?

$bitvalue=|32 does not appear valid - but I'm sure there is probably a
way?

Daniel


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
120 [ Fr, 19 Februar 2010 13:12 ] [ ID #2032857 ]

Re: Shorthand for binary bitwise math?

Hi,

On Friday 19 Feb 2010 14:12:51 120 wrote:
> I know I can do this:
>
> $bitvalue=$bitvalue|32
>
> but is there a shorthand for this?
>
> $bitvalue=|32 does not appear valid - but I'm sure there is probably a
> way?

Yes, there is:

<<<
$bitvalue |= 32;
>>>

You can also do +=, -=, *=, .= etc.

Finally, I should note that you should start a new thread bys sending a new
message to beginners [at] perl.org, not by replying to an existing message and
deleting its content.

Regards,

Shlomi Fish

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Funny Anti-Terrorism Story - http://shlom.in/enemy

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shlomi Fish [ Fr, 19 Februar 2010 13:25 ] [ ID #2032858 ]

Re: Shorthand for binary bitwise math?

On Fri, 2010-02-19 at 14:25 +0200, Shlomi Fish wrote:
> Hi,
>
> On Friday 19 Feb 2010 14:12:51 120 wrote:
> > I know I can do this:
> >
> > $bitvalue=$bitvalue|32
> >
> > but is there a shorthand for this?
> >
> > $bitvalue=|32 does not appear valid - but I'm sure there is probably a
> > way?
>
> Yes, there is:
>
> <<<
> $bitvalue |= 32;
> >>>
>
> You can also do +=, -=, *=, .= etc.
Thank you.
>
> Finally, I should note that you should start a new thread bys sending a new
> message to beginners [at] perl.org, not by replying to an existing message and
> deleting its content.

Apologies for my error - if I may point out that sending 'off list'
replies is also equally rude.

>
> Regards,
>
> Shlomi Fish
>
> --
> ------------------------------------------------------------ -----
> Shlomi Fish http://www.shlomifish.org/
> Funny Anti-Terrorism Story - http://shlom.in/enemy
>
> Deletionists delete Wikipedia articles that they consider lame.
> Chuck Norris deletes deletionists whom he considers lame.
>
> Please reply to list if it's a mailing list post - http://shlom.in/reply .
>


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
120 [ Fr, 19 Februar 2010 13:58 ] [ ID #2032859 ]

Re: Shorthand for binary bitwise math?

On Fri, 19 Feb 2010 22:58:24 +1000, 120 <zen158416 [at] zen.co.uk> wrote:

> Apologies for my error - if I may point out that sending 'off list'
> replies is also equally rude.

May I ask about this netiquette? I usually thank people who have helped me
"off list", as I don't like to clog everyone's email with my thank you
note.


--
Dave Tang


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
d.tang [ Mo, 22 Februar 2010 02:06 ] [ ID #2033063 ]

Re: Shorthand for binary bitwise math?

On Mon, 2010-02-22 at 11:06 +1000, Dave Tang wrote:
> On Fri, 19 Feb 2010 22:58:24 +1000, 120 <zen158416 [at] zen.co.uk> wrote:
>
> > Apologies for my error - if I may point out that sending 'off list'
> > replies is also equally rude.
>
> May I ask about this netiquette? I usually thank people who have helped me
> "off list", as I don't like to clog everyone's email with my thank you
> note.
>
It's generally considered very rude - but the world is full of rude
arseholes. Many of them can be found on the perl list.


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
120 [ Mo, 22 Februar 2010 07:58 ] [ ID #2033064 ]

Re: Shorthand for binary bitwise math?

120 wrote:
> On Mon, 2010-02-22 at 11:06 +1000, Dave Tang wrote:
>> On Fri, 19 Feb 2010 22:58:24 +1000, 120 <zen158416 [at] zen.co.uk> wrote:
>>
>>> Apologies for my error - if I may point out that sending 'off list'
>>> replies is also equally rude.
>>
>> May I ask about this netiquette? I usually thank people who have helped me
>> "off list", as I don't like to clog everyone's email with my thank you
>> note.
>>
> It's generally considered very rude - but the world is full of rude
> arseholes. Many of them can be found on the perl list.

Nonsense. I have posted hundreds of replies to this list over six years
now; the vast majority were copied to the OP and not a soul has
complained until now, although people have become highly agitated about
relatively insignificant things.

Rob

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Rob Dixon [ Mo, 22 Februar 2010 13:09 ] [ ID #2033065 ]

Re: Shorthand for binary bitwise math?

>>>>> "1" == 120 <zen158416 [at] zen.co.uk> writes:

>> "off list", as I don't like to clog everyone's email with my thank
>> you note.
>>
1> It's generally considered very rude - but the world is full of rude
1> arseholes. Many of them can be found on the perl list.

which perl list? there are many. do you include yourself as you are on
this list? do you actually help people here (don't recall seeing you in
many threads)? do you think you have the right to call others names
given that you are not a regular helper here? think about this before
you reply and start calling me names too.

list netiquette is there for a reason. yes, it is something that needs
to be taught and retaught to many newbies. this is one reason i wanted
to create a set of guidelines (NOT an FAQ, it is different) for this
list. it would include netiquette as well as how to best ask for help
here.

uri

--
Uri Guttman ------ uri [at] stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Uri Guttman [ Mo, 22 Februar 2010 23:44 ] [ ID #2033072 ]

Re: Shorthand for binary bitwise math?

On 2010.02.22 17:44, Uri Guttman wrote:
>>>>>> "1" == 120 <zen158416 [at] zen.co.uk> writes:
>
> >> "off list", as I don't like to clog everyone's email with my thank
> >> you note.
> >>
> 1> It's generally considered very rude - but the world is full of rude
> 1> arseholes. Many of them can be found on the perl list.
>
> which perl list? there are many. do you include yourself as you are on
> this list? do you actually help people here (don't recall seeing you in
> many threads)? do you think you have the right to call others names
> given that you are not a regular helper here? think about this before
> you reply and start calling me names too.
>
> list netiquette is there for a reason. yes, it is something that needs
> to be taught and retaught to many newbies. this is one reason i wanted
> to create a set of guidelines (NOT an FAQ, it is different) for this
> list. it would include netiquette as well as how to best ask for help
> here.

I propose that a beginners-policy [at] perl.org list be configured, so that
Uri can list his initial list policy guidelines (ie rules) be discussed,
and a new AUP be created.

The policy can be decided overall by those who have belonged to the
community the longest, and who answer questions here, and in the more
advanced arenas.

Personally, I've asked questions here that may not belong, because there
is no Perl definition for "beginner question". With that said, I don't
like it that Uri has to spend his time spitting out the rules on a
frequent basis (especially recently).

Also, I am disgusted with name calling, regardless of ANY situation...
that is completely unacceptable, especially on this list. fwiw, in the
context the name was called, I agree with Rob... I belong to several
technical lists, and the de-facto standard is to Reply-All.

Steve

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Steve Bertrand [ Di, 23 Februar 2010 02:23 ] [ ID #2033184 ]

Re: Shorthand for binary bitwise math?

On Tue, 23 Feb 2010 11:23:23 +1000, Steve Bertrand <steve [at] ibctech.ca>
wrote:

> I belong to several
> technical lists, and the de-facto standard is to Reply-All.

Understood and thank you for your answer.


--
Dave Tang


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
d.tang [ Di, 23 Februar 2010 02:30 ] [ ID #2033185 ]

Re: Shorthand for binary bitwise math?

Uri Guttman wrote:
>
>> It's generally considered very rude - but the world is full of rude
>> arseholes. Many of them can be found on the perl list.
>
> which perl list? there are many. do you include yourself as you are on
> this list? do you actually help people here (don't recall seeing you in
> many threads)? do you think you have the right to call others names
> given that you are not a regular helper here? think about this before
> you reply and start calling me names too.
>
> list netiquette is there for a reason. yes, it is something that needs
> to be taught and retaught to many newbies. this is one reason i wanted
> to create a set of guidelines (NOT an FAQ, it is different) for this
> list. it would include netiquette as well as how to best ask for help
> here.

I suspect '120' is the same person as '7' and probably better at
trolling than Perl programming. I also think enigmatic handles are rude
and inappropriate here and have said so before.

Rob

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Rob Dixon [ Di, 23 Februar 2010 11:31 ] [ ID #2033188 ]
Perl » gmane.comp.lang.perl.beginners » file handling

Vorheriges Thema: attach a perl script to daemon services
Nächstes Thema: how to $doc->createElement with XML::LibXML