Hi,
I submitted this query before and Feherke kindly provided solution: (thread822-1198142)
I'm trying to use the same sed command to format my data but I think I missed something because it's not providing the result I'm expecting.
My original data looks like this:
MRTG$ grep -i "System" $file
<H1>Traffic Analysis for 15 -- sERITHC3602.t-mobile.co.uk</H1> <TABLE> <TR><TD>System:</TD> <TD>sERITHC3602 in </TD></TR> <TR><TD>Maintainer:</TD> <TD></TD></TR> <TR><TD>Description:</TD><TD>ATM2/0.4-aal5 layer VC link to sCRDONC3601 ATM2/0.1 </TD></TR> <TR><TD>ifType:</TD> <TD>aal5 (49)</TD></TR> <TR><TD>ifName:</TD> <TD></TD></TR> <TR><TD>Max Speed:</TD> <TD>6144.0 kbits/s</TD></TR> <TR><TD>Ip:</TD> <TD>172.30.0.49 (serithc3602)</TD></TR> </TABLE><BR>
I think the result is in one line and I'm trying to put some needed data in one line as well (separated using commas):
System,Description,ifType,ifName,Max Speed,Ip
sERITHC3602,ATM2/0.4-aal5 layer VC link to sCRDONC3601 ATM2/0.1,aal5 (49),,6144.0 kbits/s,172.30.0.49 (serithc3602)
Just to grep the System data (sERITHC3602), I used this sed command:
MRTG$ grep -i "System" $file | sed 's/.*<System>\(.*\)<\/Maintainer>.*/\1/'
I used System and Maintainer strings because I know the data I need is between these two but I can still see the whole line after using sed.
Any help will be appreciated
Cheers!
I submitted this query before and Feherke kindly provided solution: (thread822-1198142)
I'm trying to use the same sed command to format my data but I think I missed something because it's not providing the result I'm expecting.
My original data looks like this:
MRTG$ grep -i "System" $file
<H1>Traffic Analysis for 15 -- sERITHC3602.t-mobile.co.uk</H1> <TABLE> <TR><TD>System:</TD> <TD>sERITHC3602 in </TD></TR> <TR><TD>Maintainer:</TD> <TD></TD></TR> <TR><TD>Description:</TD><TD>ATM2/0.4-aal5 layer VC link to sCRDONC3601 ATM2/0.1 </TD></TR> <TR><TD>ifType:</TD> <TD>aal5 (49)</TD></TR> <TR><TD>ifName:</TD> <TD></TD></TR> <TR><TD>Max Speed:</TD> <TD>6144.0 kbits/s</TD></TR> <TR><TD>Ip:</TD> <TD>172.30.0.49 (serithc3602)</TD></TR> </TABLE><BR>
I think the result is in one line and I'm trying to put some needed data in one line as well (separated using commas):
System,Description,ifType,ifName,Max Speed,Ip
sERITHC3602,ATM2/0.4-aal5 layer VC link to sCRDONC3601 ATM2/0.1,aal5 (49),,6144.0 kbits/s,172.30.0.49 (serithc3602)
Just to grep the System data (sERITHC3602), I used this sed command:
MRTG$ grep -i "System" $file | sed 's/.*<System>\(.*\)<\/Maintainer>.*/\1/'
I used System and Maintainer strings because I know the data I need is between these two but I can still see the whole line after using sed.
Any help will be appreciated
Cheers!