On 6/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: snip
Let's say my script is script.pl and I pass argument such as - <hostname>, it gets me the details of its record. Any help is appreciated. I know how to do that if it is a single line record.. Also, i don't know how to deal with history line (field for the history) that has multiple lines.
snip
$/ is the input seperator. It is normally set to "\n" (which is why the <> operator reads line by line), bit it looks like, given your data, you should set it to "\n\n". That will get you a record at a time. The other issue is slightly more tricky. If you didn't have that multiline field you could have easily use two spilts (one to break the record in to fields and the other to fields into key and value pairs). I would suggest splitting each record on "\n", looping over the results checking to see if the first character is a space, and appending that line to the last field if it is or creating a new key/value pair if it isn't. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/