Hello, I'm looking for help with editing a text file.
Here is a sample of the text file:
[text]variable_1|variable_2|variable_3|variable_4
variable_1|variable_2|variable_3|variable_4
variable_1|variable_2|variable_3|variable_4[/text]
I need to be able to edit variable_3 in each line that variable_3 is null.
Hopefully I'm making myself clear enough. All help very much appreciated.
Thank you, skallagrimur
Edit textfile line
Moderator: General Moderators
Re: Edit textfile line
Use a multidimensional array. Read the file into the array line by line, explode the lines on |, loop through the array making changes as needed, implode using | to get the initial formatting back, write to file.
-
skallagrimur
- Forum Newbie
- Posts: 9
- Joined: Fri Nov 12, 2010 4:33 am
Re: Edit textfile line
I'll try that. Thanks..