topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 6:18 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: [done] REQ: Removing anything before keywordA and after keywordB in .htm files  (Read 4120 times)

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hello,

I have many htm files in a folder.
I would like that an Autohotkey script opens one file, then delete anything before keyword A and after keyword B. Then save and close the htm file.
And repeat the same process for all the other htm files in the folder.

note: Keyword A & B can be a long phrase like "var this_is<_a long: "phrase" "

Thanks by advance ;)


« Last Edit: March 16, 2014, 04:35 AM by jity2 »

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hello,

In case this helps : I have found a way to do that with this freeware : DNgrep
http://code.google.com/p/dngrep/

I select the folder where the htm files are located. Then I click on the right icon and I write "*.htm".

Here are the regex :

1) cut everything after keyword2 :
with regex +multiline + dot as newline checked
replace
keyword2.*
with
nothing
+ hit search then hit replace

2) cut anything before keyword1 :
with regex +multiline + dot as newline checked
replace
.*?keyword1
with
nothing
+ hit search then hit replace

voila ! ;)
see ya