replace </para> to </p>
Can anyone help me to replace
I have a HTML file in that i want to replace </para> to </p> and space? to ?space I want to do it in perl script.... |
You don't give much information.
Do a search & replace operation. 1. Put </para> in the search field and </p> in the replace field. Click on "Replace all". 2. Put space? in the search field and ?space in the replace field. Click on "Replace all". Since no one has any idea of what/where/when/how/why you want to do this it's hard to know what you're looking for. Maybe you could go into a bit more detail of what you're trying to do and what steps you have taken to solve your problem. jdk |
For vars or strings, you could use Param Expansion
Code:
t='</para>' Code:
cat t.t |
I TRY THIS CODE...BUT GIVES ERROR....CAN CORRECT IT
print "Enter the filename .ent without extention : "; chomp($file=<STDIN>); open(RED,"$file.ent"); open(WRIT,">$file.xml") || die "XML File already exit"; while(<RED>) { s/</para>"/"</p>"/g; print WRIT $_; } close(RED); close(WRIT); |
You should have said you want Perl
Code:
perl -ne 'print "$_\n" if s:</para>:</p>:' t.t Code:
#!/usr/bin/perl -w [code] open(KFILE, "<", "kfile.txt" ) or die "Can't open kfile: $!\n"; # close close(KFILE) or die "Can't close kfile: $!\n"; [code] Note the use of 'or' not '||'; its precedence thing. I highly recommend you bookmark/read http://perldoc.perl.org/ http://www.perlmonks.org/?node=Tutorials http://www.tizag.com/perlT/index.php |
All times are GMT -5. The time now is 02:18 AM. |