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

Stuck again please help

Status
Not open for further replies.

fsanchez13

Technical User
May 9, 2003
35
US
Thanks vgersh99 and jad I have the following

16:29:38
SECTION 12: TRUNK GROUP
ID TGNAME
80
81
82
100 KANSAS-INTRA
ID IPC OPC OFL MTU USG ITUSG OTUSG
80 0 15 0 0 2 0 2
81 0 0 0 0 0 0 0
82 0 0 0 0 0 0 0
100 4654 2098 0 0 8636 6040 2596
ID IPCTT OPCTT OFLTT SILC EAIPC EAITU FAOUT
80 0 15 0 0 0 0 0
81 0 0 0 0 0 0 0
82 0 0 0 0 0 0 0
100 4654 2098 0 0 0 0 0
ID IAMRC RELI INSVC OOS
80 0 0 9 0
81 0 0 1 0
82 0 0 1 0

100 0 0 864 0

Now can anyone help me strip this down so that it is one line per ID.. Like after OTUSG have IPCTT and so on with the headers and then the same with the numbers?

Also it would be nice if I could get ride of the New linw before 100 at the bottom. This happens every so often in the output but not regularly..
 
here is some ideas for you to chew on.

Do this first: delete the empty line before "100", use sed "s/^$//g" would make them disappear.

read each line, get the field number of each line.
get the line number starting with "ID"
between "ID" lines, concatenate the "ID" line with the number line.

If number of number lines are always equal to 4, it should not be that difficult, incremental by 4.

 
sed "/^$/d" filename | tr '\n' ' ' | tr "ID" '\n' | sed 's/^/I/g'

This works on my monitor, but I do not why I need the last sed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top