Anybody can help in getting the output as below.
I am pasing input file as well as output file.
Input.txt
======
<p id="wb02063.io.txt.42">
<b>Permanent Observers: </b>Algeria, Angola, Armenia, Austria,
Azerbaijan, Belgium, Bosnia and Herzegovina, Bulgaria, Croatia, Cyprus,
Czech Republic, Denmark, Egypt, Equatorial Guinea, Finland, France,
Germany, Ghana, Greece, the Holy See, Hungary, India, Ireland, Israel,
Italy, Japan, Kazakhstan, the Republic of Korea, Latvia, Lebanon,
Morocco, the Netherlands, Norway, Pakistan, Philippines, Poland,
Portugal, Romania, Russia, Saudi Arabia, Spain, Sri Lanka, Sweden,
Switzerland, Thailand, Tunisia, Turkey, Ukraine, the United Kingdom,
Yemen and the European Union.</p>
<p id="wb02063.io.txt.3">
<b>Address: </b>17th St and Constitution Ave, NW, Washington, DC 20006,
USA.</p>
<p id="wb02063.io.txt.4">
<b>Telephone: </b>(202) 458-3000; <b>fax: </b>(202) 458-3967; <b>e-mail:
</b>[EMAIL PROTECTED]; <b>internet: </b>www.oas.org.</p>
<p id="wb02063.io.txt.5">
The ninth International Conference of American States (held in Bogotá,
Colombia, in 1948) established the Organization of American States by
adopting the Charter (succeeding the International Union of American
Republics, founded in 1890). The Charter was subsequently amended by the
Protocol of Buenos Aires (creating the annual General Assembly), signed
in 1967, enacted in 1970, and by the Protocol of Cartagena de Indias,
which was signed in 1985 and enacted in 1988. The purpose of the
Organization is to strengthen the peace and security of the continent;
to promote and consolidate representative democracy, with due respect
for the principle of non-intervention; to prevent possible causes of
difficulties and to ensure the peaceful settlement of disputes that may
arise among the member states; to provide for common action in the event
of aggression; to seek the solution of political, juridical and economic
problems that may arise among them; to promote, by co-operative action,
their economic, social and cultural development; to achieve an effective
limitation of conventional weapons; and to devote the largest amount of
resources to the economic and social development of the member states.</p>
Output.txt
=======
<p id="wb02063.io.txt.42">
<b>Permanent Observers: </b>Algeria, Angola, Armenia, Austria,
Azerbaijan, Belgium, Bosnia and Herzegovina, Bulgaria, Croatia, Cyprus,
Czech Republic, Denmark, Egypt, Equatorial Guinea, Finland, France,
Germany, Ghana, Greece, the Holy See, Hungary, India, Ireland, Israel,
Italy, Japan, Kazakhstan, the Republic of Korea, Latvia, Lebanon,
Morocco, the Netherlands, Norway, Pakistan, Philippines, Poland,
Portugal, Romania, Russia, Saudi Arabia, Spain, Sri Lanka, Sweden,
Switzerland, Thailand, Tunisia, Turkey, Ukraine, the United Kingdom,
Yemen and the European Union.</p>
<int-org-block><address-block><address><verbatim-address>17th St and
Constitution Ave, NW, Washington, DC 20006,
USA.</verbatim-address></address><telephone>(202)
458-3000</telephone><fax>(202)
458-3967</fax><email>[EMAIL PROTECTED]</email><internet>www.oas.org.</internet></address-block>
<p id="wb02063.io.txt.5">
The ninth International Conference of American States (held in Bogotá,
Colombia, in 1948) established the Organization of American States by
adopting the Charter (succeeding the International Union of American
Republics, founded in 1890). The Charter was subsequently amended by the
Protocol of Buenos Aires (creating the annual General Assembly), signed
in 1967, enacted in 1970, and by the Protocol of Cartagena de Indias,
which was signed in 1985 and enacted in 1988. The purpose of the
Organization is to strengthen the peace and security of the continent;
to promote and consolidate representative democracy, with due respect
for the principle of non-intervention; to prevent possible causes of
difficulties and to ensure the peaceful settlement of disputes that may
arise among the member states; to provide for common action in the event
of aggression; to seek the solution of political, juridical and economic
problems that may arise among them; to promote, by co-operative action,
their economic, social and cultural development; to achieve an effective
limitation of conventional weapons; and to devote the largest amount of
resources to the economic and social development of the member states.</p>
To achieve the above this is the code I have written. But I am not able
to touch the <p> part which has to be removed only at the
<int-org-block> and before the <telephone> tag.
#!/usr/bin/perl -w
open(FH, "<input.txt");
open(GH, ">output.txt");
while($line=<FH>)
{
$line=~s/\n//g;
$line=~s/<b>Address:
<\/b>(.+)<\/p>/<int-org-block><address-block><address><verbatim-address>$1<\/verbatim-address><\/address>/g;
$line=~s/<b>Telephone: <\/b>(.+?);/<telephone>$1<\/telephone>/g;
$line=~s/ <b>fax: <\/b>(.+?);/<fax>$1<\/fax>/g;
$line=~s/ <b>e-mail: <\/b>(.+?);/<email>$1<\/email>/g;
$line=~s/ <b>internet:
<\/b>(.+?)\.<\/p>/<internet>$1<\/internet><\/address-block>/g;
print GH "$line\n";
}
Please help
--
N. Ganesh Babu
Asst. Production Manager
Apex Logical Dataconversion Pvt. Ltd.
303 & 304 M.G.R. Estate
Dwarakapuri Colony
Panjagutta
Hyderabad
India
091-040-23353859
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]