#155431 - 2006-01-16 07:48 PM
FIND "String" in a text file, and REPLACE with another "String"
dataspike
Getting the hang of it
Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
I have Citrix installed on all my workstations and I have a particular application that I am moving to a new server, with a new "Address", so I want to change the address in the .INI file on all the workstations. I found the ReadFile UDF, and thought I could try that, but I wasn't sure how to work it. I also thought I'd see if anyone else has already to tried to accomplish this?Quote: ;Function ReadFile() ; ;Author Radimus ; ;Contributors Lonky... This is basically his code that I trimmed down to its ; simplest function ; ;Action Reads a file into an array ; ;Syntax $array=ReadFile($file) ; ;Version 1.0.1 ; ;Date 10/21/2003 ; ;Date Revised 10-22-2003 - dimmed vars ; ;Parameters file ; source filename ; ;Remarks Pair this with WriteFile() to read and write an entire file easily ; ;Returns @error if failed ; ;Dependencies None ; ;KiXtart Ver 4.02 ; ;Example(s) $array=ReadFile('c:\file.txt') Function ReadFile ($file ) Dim $lf , $f , $_ , $t $lf =chr (10 ) $f =freefilehandle $_ =open ($f ,$file ) if @error exit @error endif do $t =$t +$lf +readline ($f ) until @error $_ =close ($f ) $ReadFile =split (substr ($t ,2 ),$lf ) EndFunction [ 22. October 2003, 11:26: Message edited by: Radimus ] Any help/ideas would be awesome. Thanks, Chris
Top
FIND "String" in a text file, and REPLACE with another "String"
dataspike
2006-01-16 07:48 PM
Re: FIND "String" in a text file, and REPLACE with another "String"
Howard Bullock
2006-01-16 08:12 PM
Re: FIND "String" in a text file, and REPLACE with another "String"
dataspike
2006-01-16 09:19 PM
Re: FIND "String" in a text file, and REPLACE with another "String"
Howard Bullock
2006-01-16 10:00 PM
Re: FIND "String" in a text file, and REPLACE with another "String"
dataspike
2006-01-16 10:58 PM
Re: FIND "String" in a text file, and REPLACE with another "String"
NTDOC
2006-01-16 11:04 PM
Re: FIND "String" in a text file, and REPLACE with another "String"
dataspike
2006-01-16 11:40 PM
Re: FIND "String" in a text file, and REPLACE with another "String"
Lonkero
2006-01-17 09:06 AM
Re: FIND "String" in a text file, and REPLACE with another "String"
dataspike
2006-01-17 07:32 PM
Re: FIND "String" in a text file, and REPLACE with another "String"
Lonkero
2006-01-16 09:25 PM
Moderator: Glenn Barnas , NTDOC , Arend_ , Jochen , Radimus , Allen , ShaneEP , Ruud van Velsen , Mart
0 registered
and 2220 anonymous users online.