I'm trying to work on a script that will grab a router interface report and generate the numbers of "in use" and "un-used" ports per device. Right now, I've got a cut down of the report as follows:
My script takes that data and outputs this:
What I want to get rid of is the second occurrence of:
Device Name: CHRXNCLH92A-P-CI-9010-02
Here is my code:
Can anyone give me a method to prevent the second printing of the device name?
I'm trying to work on a script that will grab a router interface report and generate the numbers of "in use" and "un-used" ports per device. Right now, I've got a cut down of the report as follows:
My script takes that data and outputs this:
What I want to get rid of is the second occurrence of:
Device Name: CHRXNCLH92A-P-CI-9010-02
Here is my code:
Can anyone give me a method to prevent the second printing of the device name?
Thanks!
Marc
import your report in to some file (say report_file)and try using this awk commad to remove duplicate lines
The issue with this approach is that..as I said...the data I've provided is a cut down of the actual report. I a real report, there will be data from multiple devices listed.
So constantly writing extra files so I can then clean them up is a lot of extra cycles I don't want to have to do unless I'm forced to.
But thanks for the input!
Marc
Quote:
Originally Posted by zozoo
import your report in to some file (say report_file)and try using this awk commad to remove duplicate lines
---------- Post updated at 03:28 PM ---------- Previous update was at 03:16 PM ----------
Ok, Some of this is completely new to me.
I know it's a lot happening, but can you explain the logic?
I've never seen what appears to be awk being used like a switch?
Quote:
Originally Posted by Yoda
Here is a complete program that might work for you:
Here are the results
So this failed to parse the device name correctly and missed some data.
I'm not 100% on the logic and wonder if you can explain so I can troubleshoot?
I have a script that builds a database ~30 million lines, ~3.7 GB .cvs file. After multiple optimzations It takes about 62 min to bring in and parse all the files and used to take 10 min to remove duplicates until I was requested to add another column. I am using the highly optimized awk code:
awk... (34 Replies)
how to duplicate an output from a shell command?
for example:
`date` will give the current date to the console.
I want this to be displayed in console and also parallely store it in file or variable.
user1@solaris4:~> date
Tue Feb 28 17:48:31 EST 2012
user1@solaris4:~> date > file
... (3 Replies)
Hi,
My problem is the following, I have a little shell script that has a couple of functions... in one function I start an app like this...
runmqtrm -m $ourManager -q $ourMQSYS.EVTINITQ 1>/dev/null 2>&1 &
In another function I kill that app using
kill -s SIGKILL $triggerMonitorPID... (15 Replies)
I have a text file like this
...
B 16 1.340E+05
A 18 3.083E+02
Wu123 1.365E+02
...
I would like to get rid of the 7th character of each line if this is a space character.
Thank you,
Sarah (5 Replies)
Hi,
Is there anyway to duplicate output without using tee?
Let me explain the problem.
We are use ssh to login to remote server and save output to a file using tee commands for auditing purposes. When we use vi editor in ssh session, letters get garbled and cant really use vi. Without tee it... (7 Replies)
I have to process a data file in Ab Initio. This data file is pipe delimited. BUt the file may have a Disclaimer line at the end. So before picking it for processing, I need to check if this line is there I need to remove it. ANy suggestions.
Thanks
Shalu (1 Reply)
i have a bad problem with multiple occurances of the same file in
different directories.. how this happened i am not sure! but I know
that i can use awk to scan multiple directory trees to find an
occurance of the same file... some of these files differ somwhat
but that does not matter! the... (4 Replies)
Hi everyone,
Can someone possibly help me with this problem I am having please.
I wrote a Korn shell script to manipulate currency amounts in a way that a person could use this script to determine the minimum number of coins required to make a certain amount.
for example when entered on the... (2 Replies)