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!

re-arrange a data file 1

Status
Not open for further replies.

jdespres

MIS
Aug 4, 1999
230
US
I would like to rearrange a data file that looks like:

server1 policy1 policy2
server2 policy3
server3 policy1 policy3

to look like:

server1 policy1
server1 policy2
server2 policy3
server3 policy1
server3 policy3

How can I do this with awk?

Thanks..

Joe Despres
 
Code:
awk '{for(i=2;i<=NF;++i)print $1,$i}' input > output

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top