View Full Version : How to delete a line in text file

10-11-2008, 02:39 AM
Hi everyone, newcomer here. The project I'm working on is a text file parser. I'm trying to have it remove a line of text if a certain pattern isn't found on the line.

myText.txt file has
10/10/2008 - The quick brown fox jumped over the moon.
10/10/2008 - The quick brown fox jumped over the sun.

I want to do a search of each line of the text file and delete the line if it didn't have the required pattern, like "moon", the second line will be deleted since it doesn't contain the string "moon" in it.

10-11-2008, 02:53 AM
Howdy and Welcome... :)

Flash has no capability to modify the external file... You will have to use a server side script to do so...

10-11-2008, 03:03 AM
Thanks for the reply.

I forgot to mention that I'm using Flex Builder and making an AIR program. I guess this would fit more into the Flex threads. If an AIR program can't do it, I think I might have to pick up PHP to do it.

10-11-2008, 03:18 AM
Well... I know you have an access to the file system in AIR, so I know that AIR should be able to take care of the job... But I did not have a chance to mess with it, so I'll just give you a link so that you can experiment... ;)


I moved this thread to AIR forum...

Flash Gordon
10-11-2008, 08:01 AM
simply rewrite the file much like php.
search for your changes, makes your changes, overwrite the old file.