Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Line Records

Status
Not open for further replies.

xenolith

ISP
Mar 4, 2002
51
I have an input file that looks like:

User-Name = username1
Calling-Station-Id = 8653456422
Called-Station-Id = 3545841658

--
User-Name = username2
Calling-Station-Id = 3653523479
Called-Station-Id = 8514751473

--

I need to turn it into:

username1,8653456422,3545841658
username2,3653523479,8514751473

Not sure if AWK is my best bet for this or not? Any help is appreciated
 
Try this
Code:
{
  if ($1 == "User-Name") {
    printf $3 ","
    getline
    printf $3 ","
    getline
    print $3
  }
}
Hope this helps. CaKiwi
 
Exactly what i needed CaKiwi! Thanks a million!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top