help rewrite files
am 21.08.2009 17:04:00 von zilore mumba--===============1651437771==
Content-Type: multipart/alternative; boundary="0-53834415-1250867040=:93986"
--0-53834415-1250867040=:93986
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Further to my earlier mail, this is how I have constructed my search/replac=
e patterns
s/nxny d{4} 5041/nxny 5041/g; =A0 # nxny followed by 4 digits t=
hen 5041 replace by nxny 5041
s/(nx d{4}|ny 1)/nx 71|ny 71/g; # nx followed by 4 digits & ny =
1 replace by nx 71 ny 71
s/(d{4} x 1)/(71 x 71)/g; =A0 # (4=
digits x 1)=A0 in brackets replace by (71 x 71)
I wonder if the search/replace syntax is correct
Thanks for help
Zilore
=0A
--0-53834415-1250867040=:93986
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
top" style=3D"font: inherit;">Further to my earlier mail, this is how I hav= |
Further to my earlier mail, this is how I have = constructed=20 my search/replace = patterns =20 s/nxny d{4} 5041/nxny 5041/g; # = nxny=20 followed by 4 digits then 5041 replace by nxny 5041 s/(nx = d{4}|ny 1)/nx=20 71|ny 71/g; # nx followed by 4 digits = & ny 1=20 replace by nx 71 ny 71 s/(d{4} x 1)/(71 x=20 = 71)/g; &= nbsp; =20 # (4 digits x 1) in brackets replace by (71 x 71) I = wonder if the=20 search/replace syntax is correct Thanks for=20 help Zilore |
------_=_NextPart_001_01CA2278.D1852416--
--===============0873861314==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0873861314==--
RE: help rewrite files
am 21.08.2009 21:21:52 von zilore mumba--===============0852669356==
Content-Type: multipart/alternative; boundary="0-564447578-1250882512=:87700"
--0-564447578-1250882512=:87700
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Thanks very much Curtis.
I will try your suggestions.
Meanwhile, below is some of the text that appears in my files. The text to =
be replaced is in blue. Somewhere in the file there is nxny 1369 1380. 1369=
is the correct one (37 x 37).
The people who are writing the files (these are forecast winds ...) are wri=
ting in complex format, hence the double headers and my software is not abl=
e to read correctly because of double headers.
Zilore
rec 1:0:date 2009072900 UGRD kpds5=3D33 kpds6=3D100 kpds7=3D850 levels=3D(3=
,82) grid=3D255 850 mb 24hr fcst:
=A0 UGRD=3Du wind [m/s]
=A0 timerange 0 P1 24 P2 0 TimeU 1=A0 nx 1380 ny 1 GDS grid 0 num_in_ave 0 =
missing 0
=A0 center 98 subcenter 0 process 110 Table 1
=A0 latlon: lat=A0 90.000000 to 0.000000 by 2.500000=A0 nxny 1380
=A0 long -90.000000 to 0.000000 by 2.500000, (1380 =
x 1) scan 0 mode 128 bdsgrid 1
=A0 min/max data -21.0971 -5.09805=A0 num bits 14=A0 BDS_Ref -21.0971=A0 De=
cScale 0 BinScale -10
=0A
--0-564447578-1250882512=:87700
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
top" style=3D"font: inherit;">Thanks very much Curtis. |
--0-564447578-1250882512=:87700--
--===============0852669356==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0852669356==--
Re: help rewrite files
am 21.08.2009 22:57:20 von jwkenneOn Aug 21, 2009, at 3:21 PM, zilore mumba wrote:
> Thanks very much Curtis.
> I will try your suggestions.
> Meanwhile, below is some of the text that appears in my files. The
> text to be replaced is in blue. Somewhere in the file there is nxny
> 1369 1380. 1369 is the correct one (37 x 37).
>
> The people who are writing the files (these are forecast winds ...)
> are writing in complex format, hence the double headers and my
> software is not able to read correctly because of double headers.
> Zilore
>
> rec 1:0:date 2009072900 UGRD kpds5=33 kpds6=100 kpds7=850
> levels=(3,82) grid=255 850 mb 24hr fcst:
> UGRD=u wind [m/s]
> timerange 0 P1 24 P2 0 TimeU 1 nx 1380 ny 1 GDS grid 0 num_in_ave
> 0 missing 0
> center 98 subcenter 0 process 110 Table 1
> latlon: lat 90.000000 to 0.000000 by 2.500000 nxny 1380
> long -90.000000 to 0.000000 by 2.500000, (1380 x 1) scan 0
> mode 128 bdsgrid 1
> min/max data -21.0971 -5.09805 num bits 14 BDS_Ref -21.0971
> DecScale 0 BinScale -10
You /cannot/ do what you want to do. These are variable-length
records. You cannot rewrite them; you /must/ create a new file.
--
John W Kennedy
"Compact is becoming contract,
Man only earns and pays."
-- Charles Williams. "Bors to Elayne: On the King's Coins"
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: help rewrite files
am 22.08.2009 00:08:00 von Bill LuebkertJohn W Kennedy wrote:
>
> You /cannot/ do what you want to do. These are variable-length
> records. You cannot rewrite them; you /must/ create a new file.
Sure he can - if you noticed the code earlier, you would note
that he read the file in, modified and pushed each line into
an array and then rewound and wrote it back.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs