S
Skeets
i have done some research, but can't see anything that explains simple
file writing. eventually, i may end using rexml, but for now i just
want to use a simple text file.
ip.txt contains three lines of text. they are as follows:
#ip 127.0.0.1
#email (e-mail address removed)
#duration 600
thanks to help i received on this forum, i know how to open the file.
i also figured out how to grep a line of text and then manipulate the
line so i get only the data of interest.
what i don't know how to do is to...
1. write this data to a newly created file (case: file doesn't exist)
2. overwrite the data (case: file exists but data needs to be updated).
eg, let's say my ip changed to 127.0.0.2. i want to delete "#ip
127.0.0.1" and replace it with "#ip 127.0.0.2". i i'd also consider if
deleting just 127.0.0.1 and replacing it with 127.0.0.2 if it makes
more sense.
can anyone point me to a tutorial or lend a hand?
tia...
file writing. eventually, i may end using rexml, but for now i just
want to use a simple text file.
ip.txt contains three lines of text. they are as follows:
#ip 127.0.0.1
#email (e-mail address removed)
#duration 600
thanks to help i received on this forum, i know how to open the file.
i also figured out how to grep a line of text and then manipulate the
line so i get only the data of interest.
what i don't know how to do is to...
1. write this data to a newly created file (case: file doesn't exist)
2. overwrite the data (case: file exists but data needs to be updated).
eg, let's say my ip changed to 127.0.0.2. i want to delete "#ip
127.0.0.1" and replace it with "#ip 127.0.0.2". i i'd also consider if
deleting just 127.0.0.1 and replacing it with 127.0.0.2 if it makes
more sense.
can anyone point me to a tutorial or lend a hand?
tia...