| |||||||||||
| |||||||||||
File handling in TCL Posted by Panthini (Panthini), 1 October 2005 Hi,I have a config file which contains multiple entries of following format: =====Config file================== HOST_NAME=<name HOST_INDEX=<n> IP_ADDRESS=<ip> PASSWORD=<passwd> ====================== I want to write a tcl script which has follwoing functionalities: 1) read the file 2) search for required "'host name" 3) get the respective IP and password and save in some local variables, which can be used for automation. I have open that config file from my script , I think I can search the host name by grepping for the word, but how do I get the respective IP and password? Thanks in advance. Panthini Posted by admin (Graham Ellis), 1 October 2005 I would use a regular expression match (see the regexp command to identify the incoming data lines for the IP address and password, and add extra parameters onto the regexp to capture the changing data - i.e. the IP address and the password.Posted by thangbomvietnam (thangbomvietnam), 8 August 2006 dear Graham Ellisim a newbei,Can y write exaxly that program. ex: i have a file with content: 1.2.3.4 number 6 1.4.5.6 number 7 9.4.6.3 number 8 how can i take second line to show result is 1.4.5.6 number 7. Posted by admin (Graham Ellis), 8 August 2006 open the file, read 2 lines (gets), use puts on seond linePosted by thangbomvietnam (thangbomvietnam), 10 August 2006 hi!i dont know how read from first line to second line.I think must use for loop!right?!.But i cant make it .Can y write it,please!!Posted by admin (Graham Ellis), 10 August 2006 on 08/10/06 at 08:33:34, thangbomvietnam wrote:
No, sorry, not on this forum. We're very much providing a technical support service for people with questions on their Tcl - it's not our mission to write complete programs, nor (here) to train you from scratch - there are much better ways of learning Tcl. See here P.S. Emails to the email address you are registered with are bouncing. Please correct your profile so that messages to notify you of new posts in this thread don't spam our administrator's mailbox ![]() This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
| Course Booking Other Forum Posts File handling in TCL
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||
.Can y write it,please!!