transposing lines to columns

view story

http://www.unix.com – Okay folks, here's a question. I tried searching but couldn't find exactly what I needed. I have a text file (excerpt below). This text file is an extract I did from several hundred pages of datasheets using grep so I could look only at the site history for each site. The problem is that there is a single row for EACH site visit. I want to condense this list so that there is one line per site, and multiple instances (columns) of "site visits" for each site. There are a total of 47 unique site names, and each site has between 3 and 13 instances of "history" (i.e. t (HowTos)