This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Strange's profile picture

Search and Replace characters within a file

Started by Strange, 09 January 2015 - 10:00 AM
Strange #1
Posted 09 January 2015 - 11:00 AM
Hi

I have a large (1000ish lines) file, which contains @ signs where I want double quote marks "

what's the easiest way to process the file and exchange every @ for a " ?

strnage
theoriginalbit #2
Posted 09 January 2015 - 11:21 AM
string.gsub is what you're looking for. just read all the contents of the file into a string and use gsub to replace all the @ with "
Strange #3
Posted 09 January 2015 - 11:47 AM
All done - many thanks (once I remembered to close the file at the end!)

strange