How to copy html text content from a section of several pages to the section of other several different pages (with the tags of the text too)
-
in fact, I have to change the design of a site, but I have to keep thousands of articles. I can’t copy every text article in the new template, page by page. Must using something quicker.
-
@Robin-Cruise said in How to copy html text content from a section of several pages to the section of other several different pages (with the tags of the text too):
I can’t copy every text article in the new template, page by page. Must using something quicker.
This problem is so complex I think it would need multiple steps, each building on the previous one and possibly using a different process. Of course as @PeterJones states using a programming language would work, but you’d need to learn that and I suppose time is of the essence.
My idea would likely build on some abilities you already know (or at least know of) and should be able to accomplish with little effort.
The steps would be:
- Copy both folders elsewhere as it would be very important to do all this in offline copies and then test the results and proof read some of the files to confirm the results.
- For the first file which provides the text to be inserted into the second file use a regex to remove ALL but the lines that will be copied. This could be accomplished with a regex using the Find in Files function.
- Add the content of the first file which remains to the end of the second file. It may require an additional line to delimit the addition, say a line of hash’s (######…) in between the current file content and the additional new lines from file 1, this might help in the next step.
- Again using the Find in Files function, changing out the old data with the additional lines at the bottom of each file from step #3.
- Proof the new files to confirm data changed as required.
Notice there is a big gap in all this. That is how do you determine the file name of the donor file and it’s replacement file in the new structure. You haven’t mentioned that at any point and I think that is going to be the biggest hurdle, unless some naming convention was used to make it easier to pair the files. If a naming convention was used such as “design1file0001.html” and it’s pair in the new structure such as “file0001structure2.html”. If something like this was used then again a sort and regex process within Notepad++ might get the 2 files paired relatively easily and then enable you to create a “bat” (MS-DOS batch) file which would do step #3.
Terry
-
@Terry-R yes, this was my solution from the beginning. Delete everything between
<body>
and<!-- * * * * * START HERE * * * * * -->
and delete everything after<!-- * * * * * END HERE * * * * * -->
and</body>
So to keep the text content (and the meta tags of the beginning of html)And replace those too section (deleted) with the format style (html code) of the new web template. And I can use TextCrawler software for larger codes in order to make Search and Replace.
Yes, I wish it was a safer way than that. Regex would have been much better, if if it could be used, even in more steps.
-
@Robin-Cruise said in How to copy html text content from a section of several pages to the section of other several different pages (with the tags of the text too):
Regex would have been much better, if if it could be used, even in more steps.
I think you are still missing the point, how do you pair the files. Regex has NO concept of files. It is tasked with editing or finding characters within other characters. In this case it is either presented with a tab (within NPP) or a text from a file if using the Find in Files function. it doesn’t know where the text came from, nor where it goes after the regex is finished. it is just a step in the process, which NPP handles from start to finish.
Your biggest job is as I say, pairing the files together, the other steps are fairly simple to create.
Terry
-
actually, @guy038 guy has a great idea with
Bookmark
, except notepad++ has not yet the does not yet have the possibility of multiplebookmarks
and the possibility of insert them into a specific folder. Because the name of the html files are identicaly, only the html body is different , and must put the text where I indicated.I could use copy bookmark in one folder files, and paste it into another folder.
-
@Robin-Cruise said in How to copy html text content from a section of several pages to the section of other several different pages (with the tags of the text too):
I could use copy bookmark in one folder files, and paste it into another folder.
I think at this point your “original idea” backed up by some input from this forum (my idea which seems to correlate to yours and upvotes of it) should tell you that it is the RIGHT solution. Don’t going looking for things you know don’t exist and hoping.
The idea presented is right, easy to understand and should be “safe” as you put it. As you have identical filenames in both structures my main concern has now evaporated (how to pair the files).
So for getting a “bat” file created you need the filenames in 2 lists. You would a “DIR” command at the command prompt with some parameters which leave the list in a bare state (hint /B) and possibly sorted (hint again /ON).
Terry
-
maybe the new future of Multiple Bookmark should memorize the file names and the selected content in a temporary txt file before making a replacement in other files. And it can replace the content in order, from A-Z names of files. Also, may skip the content of the file that does not have a pair name. Something like that.
-
@Robin-Cruise said in How to copy html text content from a section of several pages to the section of other several different pages (with the tags of the text too):
maybe the new future of Multiple Bookmark should memorize the file names and
I will say this once only. Forget what doesn’t exist. If you are serious about fixing your immediate problem, continuing to hope is pointless. You have the answer from the forum. We can help with portions such as helping create the regex to remove text not needed, and insert other text. We can also help with creating the BAT file using regex.
But if you continue down this road of “hoping” you will get nowhere and others here will also likely dismiss your requests as you don’t seem to be overly concerned about solving it either.
Terry
-
Layout a website in pure html with over 3000 pages is complete nonsense!
Сms for the site))) -
THIS IS THE ANSWER !
A GREAT ANSWER for this problem, but using PowerShell in Windows. Very simple !!