Sponsored Content
Top Forums Shell Programming and Scripting join files cisco command output Post 302470572 by durden_tyler on Wednesday 10th of November 2010 11:38:09 AM
Old 11-10-2010
Code:
$
$
$ cat ports
Gi2/11
Gi2/14
Gi2/15
Gi2/16
Gi2/17
$
$
$ cat showintstatus
Gi2/11 serverusa connected 176 full 1000 10/100/1000BaseT
Gi2/14 serverusa connected 199 full 1000 10/100/1000BaseT
Gi2/20 serverusa connected 210 full 1000 10/100/1000BaseT
Gi2/16 serverusa connected 220 full 1000 10/100/1000BaseT
$
$
$ cat showmacaddresstable
176 0019b9e365d6 Gi2/11
176 001d09f0a40d Gi2/11
176 002497f8e8cb Gi2/11
199 0001d7711f05 Gi2/14
210 0001e9933y08 Gi2/20
230 0002w7654z01 Gi2/17
$
$
$ ##
$ awk 'FILENAME == "ports" {x[$0] = "y"}
       FILENAME == "showintstatus" && x[$1] == "y" {x[$1] = $0}
       FILENAME == "showmacaddresstable" && x[$3] != "" && x[$3] != "y" {print x[$3],$0}
      ' ports showintstatus showmacaddresstable
Gi2/11 serverusa connected 176 full 1000 10/100/1000BaseT 176 0019b9e365d6 Gi2/11
Gi2/11 serverusa connected 176 full 1000 10/100/1000BaseT 176 001d09f0a40d Gi2/11
Gi2/11 serverusa connected 176 full 1000 10/100/1000BaseT 176 002497f8e8cb Gi2/11
Gi2/14 serverusa connected 199 full 1000 10/100/1000BaseT 199 0001d7711f05 Gi2/14
$
$

tyler_durden
This User Gave Thanks to durden_tyler For This Post:
 

9 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

using join command for files

Hi, I have to join 2 files based on two key field columns. But join command allows to give only one key column for fetching.So kindly update me whether i can compare 2 files based on two key columns or more than one key column.If so what is the syntax to compare it. With thanks in advance,... (12 Replies)
Discussion started by: subra
12 Replies

2. OS X (Apple)

Command line tool to join multiple .wmv files?

I need a simple command line executable that allows me to join many wmv files into one output wmv file, preferrably in a simple way like this: wmvjoin file1.wmv file2.wmv .... > outputfile.wmv So what I want is the wmv-equivalent of mpgtx I cannot find it on internet. Thanks. (2 Replies)
Discussion started by: karman
2 Replies

3. Shell Programming and Scripting

join (pls help on join command)

Hi, I am a new learner of join command. Some result really make me confused. Please kindly help me. input: file1: LEO oracle engineer 210375 P.Jones Office Runner ID897 L.Clip Personl Chief ID982 S.Round UNIX admin ID6 file2: Dept2C ID897 6 years Dept5Z ID982 1 year Dept3S ID6 2... (1 Reply)
Discussion started by: summer_cherry
1 Replies

4. UNIX for Dummies Questions & Answers

Join 2 files with multiple columns: awk/grep/join?

Hello, My apologies if this has been posted elsewhere, I have had a look at several threads but I am still confused how to use these functions. I have two files, each with 5 columns: File A: (tab-delimited) PDB CHAIN Start End Fragment 1avq A 171 176 awyfan 1avq A 172 177 wyfany 1c7k A 2 7... (3 Replies)
Discussion started by: InfoSeeker
3 Replies

5. UNIX for Dummies Questions & Answers

how to join two files using "Join" command with one common field in this problem?

file1: Toronto:12439755:1076359:July 1, 1867:6 Quebec City:7560592:1542056:July 1, 1867:5 Halifax:938134:55284:July 1, 1867:4 Fredericton:751400:72908:July 1, 1867:3 Winnipeg:1170300:647797:July 15, 1870:7 Victoria:4168123:944735:July 20, 1871:10 Charlottetown:137900:5660:July 1, 1873:2... (2 Replies)
Discussion started by: mindfreak
2 Replies

6. UNIX for Dummies Questions & Answers

How to use the join command to obtain tab delimited text files as an output?

How do you use the join command and obtain tab delimited text files as an output? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

7. UNIX for Dummies Questions & Answers

How to use the the join command to join multiple files by a common column

Hi, I have 20 tab delimited text files that have a common column (column 1). The files are named GSM1.txt through GSM20.txt. Each file has 3 columns (2 other columns in addition to the first common column). I want to write a script to join the files by the first common column so that in the... (5 Replies)
Discussion started by: evelibertine
5 Replies

8. Shell Programming and Scripting

How to join output of two command in same line?

Hi I am trying to figureout how to join output of two command in unix in the same line. for e.g. $ankit : df -h | egrep -w /home | awk '{print -n $1 "\t" $5}' ;stat --format=%a /home Output: 0148G /home 775 I want this output as... 0148G /home 775 Please let me know if you... (7 Replies)
Discussion started by: kotak86
7 Replies

9. Shell Programming and Scripting

Join two files combining multiple columns and produce mix and match output

I would like to join two files when two columns in each file matches with each other and then produce an output when taking multiple columns. Like I have file A 1234,ABCD,23,JOHN,NJ,USA 2345,ABCD,24,SAM,NY,USA 5678,GHIJ,24,TOM,NY,USA 5678,WXYZ,27,MAT,NJ,USA and file B ... (2 Replies)
Discussion started by: mady135
2 Replies
AGGREGATE-IOS(1)                                              General Commands Manual                                             AGGREGATE-IOS(1)

NAME
aggregate-ios - optimise a concatenated set of cisco/IOS prefix filters to help make them nice and short. SYNOPSIS
aggregate-ios <source_config >optimised_config DESCRIPTION
Takes cisco IOS configuration on stdin, and optimises any prefix filters found using aggregate(1). Optimised filters are produced on std- out. OPTIONS
None. DIAGNOSTICS
Any diagnostics produced by aggregate(1) are passed through on stderr. EXAMPLES
The following configuration fragment: ip prefix-list AS65530 description Foo, Inc ip prefix-list AS65530 permit 10.1.0.0/16 ip prefix-list AS65530 permit 10.2.0.0/16 ip prefix-list AS65530 permit 10.2.1.0/24 ip prefix-list AS65530 permit 10.3.0.0/16 ip prefix-list AS65531 description Bar.Com ip prefix-list AS65531 seq 5 permit 192.168.1.0/24 ip prefix-list AS65531 seq 10 permit 192.168.2.0/24 ip prefix-list AS65531 seq 15 permit 192.168.0.0/19 is optimised as follows: ip prefix-list AS65530 permit 10.1.0.0/16 le 24 ip prefix-list AS65530 permit 10.2.0.0/15 le 24 ip prefix-list AS65531 permit 192.168.0.0/19 le 24 SEE ALSO
aggregate(1) HISTORY
Aggregate-ios was written by Joe Abley <jabley@mfnx.net>. BUGS
All those in aggregate(1) and then some :) Joe Abley 2000 November 27 AGGREGATE-IOS(1)
All times are GMT -4. The time now is 09:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy