Insert string at beginning and end of file
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Insert string at beginning and end of file
I'm converting multiple files to HTML. I want to append <html> to the beginning of the files and </html> to the end. Is there a way to do this? Thanks.
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
\A or \` matches the beginning of text.
\z or \' matches the end of text.
They work in WildEdit (http://www.textpad.com/products/wildedit/) but, unfortunately, not in TextPad.
\z or \' matches the end of text.
They work in WildEdit (http://www.textpad.com/products/wildedit/) but, unfortunately, not in TextPad.
Thanks again for all the help! The \A works to insert <html> at the beginning, and the \' works to insert </html> at the end. However, using the \Z inserts </html> twice at the end.
I'm just trying the WildEdit demo, so I'm a newbie. When I edit my document, WildEdit creates a new one with -00 appended after the extension. I need to prevent that. Also, I'd like to run both regexes at the same time, i.e., add <html> and </html> at the beginning and end at the same time. I don't see how to do that.
I can create a macro in TextPad to do both at once, but, as I mentioned, I don't see how to run a macro in TextPad against more than one file at a time.
I'm just trying the WildEdit demo, so I'm a newbie. When I edit my document, WildEdit creates a new one with -00 appended after the extension. I need to prevent that. Also, I'd like to run both regexes at the same time, i.e., add <html> and </html> at the beginning and end at the same time. I don't see how to do that.
I can create a macro in TextPad to do both at once, but, as I mentioned, I don't see how to run a macro in TextPad against more than one file at a time.
Look closely at the times. The -00 files are backups. This way you can do a compare to ensure it really, really did what you want. When you exit WildEdit, it will prompt you and ask whether you want to delete those backup files. You can also delete the backups from the File Menu.
(2[Bb]|[^2].|.[^Bb])
That is the question.
That is the question.
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Brute force, yes you can.JimmyW wrote:can I run a TextPad macro on multiple files?
Open File1
Run MacroX
Open File2
Run MacroX
Open File3
...
This could obviously get tedious if you needed to run a TP Macro against say a thousand files. In that case, I'd look at using WildEdit, if it's possible, to do what you want. Another option would be a script in whatever you're comfortable with (VBScript, JavaScript, AutoIt, PowerShell, etc.)
(2[Bb]|[^2].|.[^Bb])
That is the question.
That is the question.