Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Prepend text to file (https://www.kinook.com/Forum/showthread.php?t=1170)

RTS 07-25-2005 02:12 AM

Prepend text to file
 
Hi

Has anyone got an idea on how I can prepend some text to a collection of files?

I'm able to iterate through the collection fine using the Process Files functionality, and have tried using the replace in file functionality to prepend the text but have had no luck.

I've tried using a regular expression starting with ^ but it seems to match the start of a line rather than start of the whole file.

Unfortunately I have no tokens I can replace at the start of the file either.

Any ideas welcome! :)

Thanks,
Chris.

kinook 07-25-2005 06:42 AM

1 Attachment(s)
Use a Replace in File action to match the entire file and put the prepend text before the replacement value (see attached).

RTS 07-25-2005 07:30 AM

That's so simple I feel a bit daft now :)

Thanks for the help

miker 03-29-2006 12:29 PM

prepend.bld does not work for me
 
prepend.bld does not work for me. I'm using Visual Build 6.1. Any clue why?

3/29/2006 1:25:53 PM: --------------------Starting Build: 'prepend'--------------------
3/29/2006 1:25:54 PM: Building project step 'Project steps'...
3/29/2006 1:25:54 PM: Building project step 'Create text file'...
Creating file C:\DOCUME~1\MIKER~1.MTG\LOCALS~1\Temp\abc.txt
3/29/2006 1:25:55 PM: Building project step 'Show file'...
File now contains:
String1=Testing 1234
String2=blah 456
3/29/2006 1:25:55 PM: Building project step 'Replace values'...
1 match(es) found, 1 replacement(s) made in file
3/29/2006 1:25:55 PM: Building project step 'Show file'...
File now contains:
text to prepend
String1=Testing 1234
String2=blah 456text to prepend

3/29/2006 1:25:55 PM: Build successfully completed.

kinook 03-29-2006 03:10 PM

Check Replace first match only on the Replace tab.

mevans 04-16-2018 01:21 PM

Yay! This worked. I'm glad I found it. I was originally trying to solve my problem using Write Files. Unfortunately, Write Files only lets you append or overwrite. A possible enhancement for Write Files would be to add dropdown that lets you choose the operation you want to perform:
  • Overwrite
  • Prepend
  • Append

kinook 09-06-2018 10:55 AM

Implemented in v9.7.


All times are GMT -5. The time now is 03:59 PM.


Copyright © 1999-2023 Kinook Software, Inc.