Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Remove section from a HTML file

by aaron_baugher (Curate)
on Oct 24, 2013 at 16:12 UTC ( [id://1059511]=note: print w/replies, xml ) Need Help??


in reply to Remove section from a HTML file

There's no such thing as "too complicated to match with RegExp." Often it does make sense to use a module that understands the format, but in a case like this where you're matching one exact chunk of text, a regex is pretty straightforward:

perl -0777 -p -i -e 's|<div class="sectionHeading.+?</table>\s+</div>| +|s' test.html

To apply that only to certain files, you can wrap that regex in perl code that filters multiple files through it, or use the shell to tell that command what files to work on.

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1059511]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-26 03:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found