Sponsored Content
Top Forums Shell Programming and Scripting Search from 1st match and end 2nd match Post 302965480 by Aia on Friday 29th of January 2016 02:22:46 PM
Old 01-29-2016
I wonder if this does what you want?

Code:
perl -00 -ne '/vlan\s+\/Common\/VLAN2(15|33)/ and next; s/\s+\/Common\/VLAN2(15|33)//g; print' djzah.vlan

Code:
net route-domain /Common/0 {
    id 0
    vlans {
        /Common/Interconnect
        /Common/Sync-Failover
        /Common/VLAN221
        /Common/VLAN252
        /Common/VLAN216
    }
}

net stp /Common/cist {
    interfaces {
        1.1 {
            external-path-cost 20000
            internal-path-cost 20000
        }
    }
    trunks {
        Bonded.Pair {
            external-path-cost 20000
            internal-path-cost 20000
        }
    }
    vlans {
        /Common/Interconnect
        /Common/Sync-Failover
        /Common/VLAN216
        /Common/VLAN221
        /Common/VLAN252
    }
}

net route-domain /Common/0 {
    id 0
    vlans {
        /Common/Interconnect
        /Common/Sync-Failover
        /Common/VLAN221
        /Common/VLAN252
        /Common/VLAN216
    }
}

net stp /Common/cist {
    interfaces {
        1.1 {
            external-path-cost 20000
            internal-path-cost 20000
        }
    }
    trunks {
        Bonded.Pair {
            external-path-cost 20000
            internal-path-cost 20000
        }
    }
    vlans {
        /Common/Interconnect
        /Common/Sync-Failover
        /Common/VLAN216
        /Common/VLAN221
        /Common/VLAN252
    }
}

net route-domain /Common/0 {
    id 0
    vlans {
        /Common/Interconnect
        /Common/Sync-Failover
        /Common/VLAN221
        /Common/VLAN252
        /Common/VLAN216
    }
}

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Regular Expression - match 'b' that follows 'a' and is at the end of a string

Hi, I'm struggling with a regex that would match a 'b' that follows an 'a' and is at the end of a string of non-white characters. For example: Line 1: aba abab b abb aab bab baa I can find the right strings but I'm lacking knowledge of how to "discard" the bits that precede bs.... (2 Replies)
Discussion started by: machinogodzilla
2 Replies

2. Shell Programming and Scripting

exact string match ; search and print match

I am trying to match a pattern exactly in a shell script. I have tried two methods awk '/\<mpath${CURR_MP}\>/{print $1 $2}' multipath perl -ne '/\bmpath${CURR_MP}\b/ and print' /var/tmp/multipath Both these methods require that I use the escape character. I am guessing that is why... (8 Replies)
Discussion started by: bash_in_my_head
8 Replies

3. Programming

sed no match word end with hyphen

Hi, This is my first post.It has two parts first part: I want to match a line that starts with whitespace tab or similar followed by must start with specific word and not match same word start with hyphen like this: grep height file1: height: 150px; line-height: 1.5em; height:... (4 Replies)
Discussion started by: medium_linux
4 Replies

4. Shell Programming and Scripting

Pattern match till the end of the file.

I have a file which is like this ……………………………………….. ………………………………… ………………………………… …………………………………… ……………………………………. ……………………………… <<<from_here>>> ……………………………… ………………………………. I want a script which would fetch the data starting from <<<from_here>>> in the file till the end... (2 Replies)
Discussion started by: halfafringe
2 Replies

5. Shell Programming and Scripting

Conversion if 1st column is match (awk '{s+=$1} END

Hi im trying to add numbers, got no problem with it im using awk '{s+=$1} END {print s, "MB"}', but what if the numbers are like mention below. who will i add them 2000 KB 1 MB Answer: 2001 Desired: 2000 KB 1 MB Answer: 3000 (4 Replies)
Discussion started by: invinzin21
4 Replies

6. Shell Programming and Scripting

Grep from match to the end of file

Hi i have this script : #!/bin/bash DATE=$(date '+%Y-%m-%d %H:%M' -d "1 hour ago") PASS=$(grep -A99999999999 '$DATE' /var/log/asterisk/full| grep -i 'Wrong password') it a script that ment to go over log file a hour back from now until the end of file. right now im using... (5 Replies)
Discussion started by: batchenr
5 Replies

7. Shell Programming and Scripting

sed print from last occurrence match until the end of last occurrence match

Hi, i have file file.txt with data like: START 03:11:30 a 03:11:40 b END START 03:13:30 eee 03:13:35 fff END jjjjjjjjjjjjjjjjjjjjj START 03:14:30 eee 03:15:30 fff END ggggggggggg iiiiiiiiiiiiiiiiiiiiiiiii I want the below output START (13 Replies)
Discussion started by: Jyotshna
13 Replies

8. Shell Programming and Scripting

Search file containing ps results for a match "my.cnf" and then for a second match . "ok:" and

I need to find two matches in the output from ps. I am searching with ps -ef |grep mysql for: my.cnf /bin/sh /usr/bin/mysqld_safe --defaults-file=/data/mysql/master/agis_core/etc/my.cnf after this match I want to search back and match the hostname which is x number of lines back, above the... (2 Replies)
Discussion started by: bash_in_my_head
2 Replies

9. UNIX for Beginners Questions & Answers

Compare 1st column from 2 file and if match print line from 1st file and append column 7 from 2nd

hi I have 2 file with more than 10 columns for both 1st file apple,0,0,0...... orange,1,2,3..... mango,2,4,5..... 2nd file apple,2,3,4,5,6,7... orange,2,3,4,5,6,8... watermerlon,2,3,4,5,6,abc... mango,5,6,7,4,6,def.... (1 Reply)
Discussion started by: tententen
1 Replies

10. UNIX for Beginners Questions & Answers

Data match 2 files based on first 2 columns matching only and join if match

Hi, i have 2 files , the data i need to match is in masterfile and i need to pull out column 3 from master if column 1 and 2 match and output entire row to new file I have tried with join and awk and i keep getting blank outputs or same file is there an easier way than what i am... (4 Replies)
Discussion started by: axis88
4 Replies
ZGREP(1)						    BSD General Commands Manual 						  ZGREP(1)

NAME
zgrep, zegrep, zfgrep -- print lines matching a pattern in gzip-compressed files SYNOPSIS
zgrep [grep-flags] [--] pattern [files ...] zegrep [grep-flags] [--] pattern [file ...] zfgrep [grep-flags] [--] pattern [file ...] DESCRIPTION
zgrep runs grep(1) on files or stdin, if no files argument is given, after decompressing them with zcat(1). The grep-flags and pattern arguments are passed on to grep(1). If an -e flag is found in the grep-flags, zgrep will not look for a pattern argument. zegrep calls egrep(1), while zfgrep calls fgrep(1). EXIT STATUS
In case of missing arguments or missing pattern, 1 will be returned, otherwise 0. SEE ALSO
egrep(1), fgrep(1), grep(1), gzip(1), zcat(1) AUTHORS
Thomas Klausner <wiz@NetBSD.org> BSD
December 28, 2003 BSD
All times are GMT -4. The time now is 02:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy