Kinook Software Forums

Go Back   Kinook Software Forums > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-25-2005, 02:12 AM
RTS RTS is online now
Registered User
 
Join Date: 07-07-2005
Posts: 6
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.
Reply With Quote
  #2  
Old 07-25-2005, 06:42 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,607
Use a Replace in File action to match the entire file and put the prepend text before the replacement value (see attached).
Attached Files
File Type: bld prepend.bld (1.0 KB, 582 views)
Reply With Quote
  #3  
Old 07-25-2005, 07:30 AM
RTS RTS is online now
Registered User
 
Join Date: 07-07-2005
Posts: 6
That's so simple I feel a bit daft now

Thanks for the help
Reply With Quote
  #4  
Old 03-29-2006, 12:29 PM
miker miker is online now
Registered User
 
Join Date: 01-19-2005
Location: NH
Posts: 7
Unhappy 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.
Reply With Quote
  #5  
Old 03-29-2006, 03:10 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,607
Check Replace first match only on the Replace tab.
Reply With Quote
  #6  
Old 04-16-2018, 01:21 PM
mevans mevans is online now
Registered User
 
Join Date: 04-21-2015
Posts: 24
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
Reply With Quote
  #7  
Old 09-06-2018, 10:55 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,607
Implemented in v9.7.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 04:28 PM.


Copyright 1999-2019 Kinook Software, Inc.