Sorry for the delayed response! Thanks for the suggestion, but I'm not totally comfortable creating another language dependency for the task. That's not to say that this isn't the faster, if not altogether better, solution for this issue.
You are right, though, the solution is to evaluate files and perform multiple replacements on each provided string. My apologies for the confusion. -Raymond -----Original Message----- From: Jim Cant [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 02, 2008 8:40 PM To: [email protected] Subject: Re: Multiple If I understand your problem correctly, what you are trying to do is do a global search and replace in a file. I don't think ant is the appropriate tool for this; I'd suggest Perl. Here's a command that replaces every occurence of each pattern in a line for all lines in a file and saves the original file 'fileIn.txt' to 'fileIn.txt.bak perl -i.bak -ape "s/pat1/repl1/g;s/pat2/repl2/g;...;s/patN/replN/g" You should be able to run this with the <exec> task. Note that if a replacement results in a line that matches a pattern that you match later, that replacement will be made which may not be what you want. Raymond Berg (ALLETE) wrote: > > I've got a situation where I need to search deployment files for various > server names of a variable count when moving from staging to production > automatically. However, I can't seem to figure out how to handle a > dynamic replace count. I was looking at the script task but found no > syntax that seemed to help. (Also investigated path tools and the few > string operations available) > > I'm debating whether to create a new Ant task, but I'm not comfortable > enough with my skills yet to attempt this. > > If it helps, my script is currently passing in a single delimited string > as follows: find1~replace#find2~replace2#...#findn~replacen > > Any ideas? > > Raymond > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/How-do-you-sort-and-remove-duplicates-lines-from-a -file---tp18219748p18250207.html Sent from the Ant - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
