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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rows to columns 1

Status
Not open for further replies.

sunixadm

Technical User
Sep 20, 2001
73
DE
Hi Gurus,

I have worked on this all day and can't seem to find the answer. I have this in a file:
ce0:
ipackets 113961312 ipackets64 113961312 ierrors 0 opackets 80229294 opackets64 80229294
oerrors 0 collisions 0 rbytes 735664694 rbytes64 35095403062 obytes 807304982 obytes64 9397239574
multircv 45504766 multixmt 0 brdcstrcv 1869989 brdcstxmt 398482 norcvbuf 0
noxmtbuf 0 first_collision 0 excessive_collisions 0 late_collisions 0
peak_attempts 0 length_err 0 alignment_err 0 crc_err 0 code_violations 0
ifspeed 1000000000 promisc off rev_id 32 xcvr_inits 1 xcvr_inuse 1
xcvr_addr 1 xcvr_id 2121953 cap_autoneg 1 cap_1000fdx 1 cap_1000hdx 1
cap_100T4 0 cap_100fdx 1 cap_100hdx 1 cap_10fdx 1 cap_10hdx 1
cap_asmpause 0 cap_pause 0 adv_cap_autoneg 1 adv_cap_1000fdx 1
adv_cap_1000hdx 1 adv_cap_100T4 0 adv_cap_100fdx 1 adv_cap_100hdx 1
adv_cap_10fdx 1 adv_cap_10hdx 1 adv_cap_asmpause 0 adv_cap_pause 0
lp_cap_autoneg 1 lp_cap_1000fdx 1 lp_cap_1000hdx 0 lp_cap_100T4 0
lp_cap_100fdx 1 lp_cap_100hdx 1 lp_cap_10fdx 1 lp_cap_10hdx 1
lp_cap_asmpause 0 lp_cap_pause 0 link_T4 0 link_speed 1000
link_duplex 2 link_asmpause 0 link_pause 0 link_up 1 mac_mtu 1522
mac_reset 0 lb_mode 0 qos_mode 0 trunk_mode 0 tx_inits 0
tx_starts 80229350 tx_nocanput 0 tx_msgdup_fail 0 tx_allocb_fail 0
tx_no_desc 0 tx_dma_bind_fail 0 tx_max_pkt_err 0 tx_uflo 0
tx_queue0 49795882 tx_queue1 19547891 tx_queue2 6159495 tx_queue3 4725904 tx_hdr_pkts 78173638
tx_ddi_pkts 3157474 tx_dvma_pkts 977319 mdt_reqs 0 mdt_hdr_bufs 0 mdt_pld_bufs 0
mdt_pkts 0 mdt_hdrs 0 mdt_plds 0 mdt_hdr_bind_fail 0 mdt_pld_bind_fail 0
tx_jumbo_pkts 0 tx_max_pend 39 rx_inits 0 rx_jumbo_pkts 0
rx_hdr_pkts 59677615 rx_mtu_pkts 54283697 rx_split_pkts 0 rx_no_buf 0
rx_no_comp_wb 0 rx_ov_flow 0 rx_len_mm 0 rx_tag_err 0 rx_nocanput 0
rx_msgdup_fail 0 rx_allocb_fail 0 rx_new_pages 15435849 rx_new_hdr_pgs 1864925
rx_new_mtu_pgs 13570924 rx_new_nxt_pgs 0 rx_reused_pgs 15435287 rx_hdr_drops 0
rx_mtu_drops 0 rx_nxt_drops 0 rx_rel_flow 0 rx_rel_bit 64935524
rx_pkts_dropped 0 pci_bus_speed 66 pci_err 0 pci_rta_err 0
pci_rma_err 0 pci_parity_err 0 pci_bad_ack_err 0 pci_drto_err 0
pci_dmawz_err 0 pci_dmarz_err 0 rx_taskq_waits 0 ipackets_cpu00 113961312

and I want to change it to 2 lines. One with the headings and one with the values and seperated with a comma. So it would look like this:

ipackets,ipackets64,ierrors,opackets,opackets64,oerrors,collisions,rbytes,
rbytes64,obytes,obytes64,multircv,multixmt,brdcstrcv,brdcstxmt,norcvbuf,
noxmtbuf,first_collision,excessive_collisions,late_collisions,peak_attempts,
length_err,alignment_err,crc_err,code_violations,ifspeed,promisc,rev_id,
xcvr_inits,xcvr_inuse,xcvr_addr,xcvr_id,cap_autoneg,cap_1000fdx,cap_1000hdx
,cap_100T4,cap_100fdx,cap_100hdx,cap_10fdx,cap_10hdx,cap_asmpause,cap_pause
,adv_cap_autoneg,adv_cap_1000fdx,adv_cap_1000hdx,adv_cap_100T4,adv_cap_100f
dx,adv_cap_100hdx,adv_cap_10fdx,adv_cap_10hdx,adv_cap_asmpause,
adv_cap_pause,lp_cap_autoneg,lp_cap_1000fdx,lp_cap_1000hdx,lp_cap_100T4,
lp_cap_100fdx,lp_cap_100hdx,lp_cap_10fdx,lp_cap_10hdx,lp_cap_asmpause,
lp_cap_pause,link_T4,link_speed,link_duplex,link_asmpause,link_pause,
link_up,mac_mtu,mac_reset,lb_mode,qos_mode,trunk_mode,tx_inits,tx_starts,
tx_nocanput,tx_msgdup_fail,tx_allocb_fail,tx_no_desc,tx_dma_bind_fail,
tx_max_pkt_err,tx_uflo,tx_queue0,tx_queue1,tx_queue2,tx_queue3,tx_hdr_pkts,
tx_ddi_pkts,tx_dvma_pkts,mdt_reqs,mdt_hdr_bufs,mdt_pld_bufs,mdt_pkts,
mdt_hdrs,mdt_plds,mdt_hdr_bind_fail,mdt_pld_bind_fail,tx_jumbo_pkts,
tx_max_pend,rx_inits,rx_jumbo_pkts,rx_hdr_pkts,rx_mtu_pkts,rx_split_pkts,
rx_no_buf,rx_no_comp_wb,rx_ov_flow,rx_len_mm,rx_tag_err,rx_nocanput,
rx_msgdup_fail,rx_allocb_fail,rx_new_pages,rx_new_hdr_pgs,rx_new_mtu_pgs,
rx_new_nxt_pgs,rx_reused_pgs,rx_hdr_drops,rx_mtu_drops,rx_nxt_drops,
rx_rel_flow,rx_rel_bit,rx_pkts_dropped,pci_bus_speed,pci_err,pci_rta_err,
pci_rma_err,pci_parity_err,pci_bad_ack_err,pci_drto_err,pci_dmawz_err,
pci_dmarz_err,rx_taskq_waits,ipackets_cpu00
113961312,113961312,0,80229294,80229294,0,0,735664694,35095403062,807304982
,9397239574,45504766,0,1869989,398482,0,0,0,0,0,0,0,0,0,0,1000000000,off,32
,1,1,1,2121953,1,1,1,0,1,1,1,1,0,0,1,1,1,0,1,1,1,1,0,0,1,1,0,0,1,1,1,1,0,0,
0,1000,2,0,0,1,1522,0,0,0,0,0,80229350,0,0,0,0,0,0,0,49795882,19547891,
6159495,4725904,78173638,3157474,977319,0,0,0,0,0,0,0,0,0,39,0,0,59677615,
54283697,0,0,0,0,0,0,0,0,0,15435849,1864925,13570924,0,15435287,0,0,0,0,
64935524,0,66,0,0,0,0,0,0,0,0,0,113961312

Thanks in advance for you help.

-Joe
 
Thanks feherke!

This is a great start.

Cheers,
-Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top