Sponsored Content
Full Discussion: Perl Regex problem
Top Forums Shell Programming and Scripting Perl Regex problem Post 302985719 by mrlayance on Monday 14th of November 2016 01:01:15 PM
Old 11-14-2016
Quote:
Originally Posted by Corona688
Show the input you get and the output you want.

I'm not sure that code is actually doing what you want, either. I'm guessing you want to send 'show int' to the switch, and have Perl filter the rest? Or is the command you enter in the switch LITERALLY show int | i proto.* ... because that's what I think is happening here.
I think I know the issue.

The show command shows all ports that match the criteria.

GigabitEthernet1/0/3 is down, line protocol is down (notconnect)
Last input never, output never, output hang never
Last input 17w0d, output 00:00:00, output hang never
Last input 38w0d, output 00:00:00, output hang never
Last input 48w5d, output 00:00:00, output hang never
Last input 1y27w, output 00:00:00, output hang never
GigabitEthernet1/0/18 is down, line protocol is down (notconnect)
Last input never, output 6w6d, output hang never

Those results go into a array. I can not figure out how to trim the array results to say, GigabitEthernet1/0/3
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl REGEX

Hi, Can anyone help me to find regular expression for the following in Perl? "The string can only contain lower case letters (a-z) and no more than one of any letter." For example: "table" is accepted, whether "dude" is not. I have coded like this: $str = "table"; if ($str =~ m/\b()\b/) {... (4 Replies)
Discussion started by: evilfreakz
4 Replies

2. Shell Programming and Scripting

Perl regex

I have got numbers like l255677 l376039 l188144 l340482 l440700 l254113 to match the numbers starting with '13' what would be the regex =~/13(.*)/ =======>This is not working .... But for user123,user657 regex =~/user(.*)/ ========>works Thanks for help..!! (7 Replies)
Discussion started by: trina_1
7 Replies

3. Shell Programming and Scripting

Converting perl regex to sed regex

I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly: if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies

4. UNIX for Dummies Questions & Answers

Perl Regex Help!!!

Hi, I get the following when I cat a file *.log xxxxx ===== dasdas gwdgsg fdsagfsag agsdfag ===== random data ===== My output should look like : If the random data after the 2nd ==== is null then OK should be printed else the random data should be printed. How do I go about this... (5 Replies)
Discussion started by: manutd
5 Replies

5. Programming

Perl regex

HI, I'm new to perl and need simple regex for reading a file using my perl script. The text file reads as - filename=/pot/uio/current/myremificates.txt certificates=/pot/uio/current/userdir/conf/user/gamma/settings/security/... (3 Replies)
Discussion started by: jhamaks
3 Replies

6. Programming

Perl regex

Hi Guys I have the following regex $OSRELEASE = $1 if ($output =~ /(Mac OS X (Server )?10.\d)/); output is currently Mac OS X 10.7.5 when the introduction of Mac 10.8 output changes to OS X 10.8.2 they have dropped the Mac bit so i changed the regex to be (2 Replies)
Discussion started by: ab52
2 Replies

7. Programming

Perl regex

Hello folks, Looking for a quick help on regex in my perl script. here's the string i want to parse and get the 2nd field out of it. $str = " 2013-08-07 12:29 Beta ACTIVE"; I want to extract 'Beta' out of this string. This string will keep on changing... (2 Replies)
Discussion started by: jhamaks
2 Replies

8. Shell Programming and Scripting

?= in perl regex

Could anyone please make me understand how the ?= works below .. After executing this I am getting the same output. $string="I love chocolate."; $string =~ s/chocolate(?= ice)/vanilla/; print "$string\n"; (2 Replies)
Discussion started by: scriptscript
2 Replies

9. UNIX for Advanced & Expert Users

Perl regex problem on strings with several occurences of one char

Hi all, i have the following line in a record file : retenu=non demande=non script=#vtbackup /path=/save/backup/demande position=140+70 and i want to use Perl regex to have the following output key : "retenu" value : "non" key : "demande" value "non" key : "script" value :... (2 Replies)
Discussion started by: Fundix
2 Replies

10. Shell Programming and Scripting

Perl, RegEx - Help me to understand the regex!

I am not a big expert in regex and have just little understanding of that language. Could you help me to understand the regular Perl expression: ^(?!if\b|else\b|while\b|)(?:+?\s+){1,6}(+\s*)\(*\) *?(?:^*;?+){0,10}\{ ------ This is regex to select functions from a C/C++ source and defined in... (2 Replies)
Discussion started by: alex_5161
2 Replies
BP_SREFORMAT(1p)					User Contributed Perl Documentation					  BP_SREFORMAT(1p)

NAME
bpsreformat - convert sequence formats DESCRIPTION
This script uses the SeqIO system that allows conversion of sequence formats either sequence data or multiple sequence alignment data. The name comes from the fact that Sean Eddy's program sreformat (part of the HMMER pkg) already does this. Sean's program tries to guess the input formats while in our code we currently require your to specify what the input and output formats are and if the data is from a multiple sequence alignment or from straight sequence files. Usage: bpsreformat -if INFORMAT -of OUTFORMAT -i FILENAME -o output.FORMAT -h/--help Print this help -if/--informat Specify the input format -of/--outformat Specify the output format -i/--input Specify the input file name (to pass in data on STDIN use minus sign as filename) -o/--output Specify the output file name (to pass data out on STDOUT use minus sign as filename) --msa Specify this is multiple sequence alignment data --special Will pass on special parameters to the AlignIO/SeqIO object -- most of these are for Bio::AlignIO objects Comma separated list of the following nointerleaved -- for phylip,non-interleaved format idlinebreak -- for phylip, makes it molphy format percentages -- for clustalw, show % id per line perl v5.14.2 2012-03-02 BP_SREFORMAT(1p)
All times are GMT -4. The time now is 03:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy