zaggs — 2012-05-08T11:41:22-04:00 — #1
I have a CSV file in which I need to replace some text. In column 1 I have the old phrase (of which I need to replace part of it with column 3). Column 2 is not required.
So for example here is row 1 (I have also added column 1,2,3 above each column)
$language['admin_index_page_title'] = "Welcome to Admin";
Welcome to Admin.
Админд тавтай морилно уу.
Now what I need to do is replace the text within double quotes from column 1 with the text in column 3. So column 1 will end up like this:
$language['admin_index_page_title'] = "Админд тавтай морилно уу.";
Any ideas how to do this?
starlion — 2012-05-08T12:59:01-04:00 — #2
(COMPLETELY untested. Test before writing back to the file. I'm assuming your fields are not quote-encapsulated, are seperated by commas, and lines are delimited by newline)
anthonysterling — 2012-05-08T13:27:34-04:00 — #3
Why not just reassign the column in the row?
$row = $row;
starlion — 2012-05-08T13:32:58-04:00 — #4
It's not replacing the value entirely, Anthony, he wants to slice it into the space between the quotes.... essentially the CSV file is a massive Find/Replace (Needle = Row, Replace = Row, Haystack = Row)
anthonysterling — 2012-05-08T13:35:16-04:00 — #5
Ah, got you. Thanks StarLion.