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
PIC2PS(9.1)															       PIC2PS(9.1)

NAME
pic2ps, pic2gif - convert picture files to other formats SYNOPSIS
fb/pic2ps [ -c ] [ -h height ] [ input ] fb/pic2gif [ -i ] [ -l ] [ -b depth ] [ input ] DESCRIPTION
Pic2ps converts its input image (default standard input) into encapsulated PostScript, writing the result to standard output. If the input image is full-color, its luminance is computed first, except under option -c, which produces output suitable for a color PostScript printer. Option -h sets the output image height in inches. The default height is 3", to match the default height of the .BP macro in troff -mpictures. Pic2gif converts its input image (default standard input) into a Compuserv GIF format file, writing the result to standard output. It con- verts only the first channel of the input image, which may yield wrong results -- use the -l flag or quantize(9.1) or some other dithering filter to reduce color images to a single channel. Option -i produces an interlaced output file. Option -b sets the number of bits per pixel in the output file. The default is 8, which is the maximum. Option -l makes pic2gif compute the NTSC luminance of its input. If pic2gif's input contains no color map, it assumes that it is a 256 grey shade monochrome image. SOURCE
/sys/src/fb/pic2ps.c /sys/src/fb/pic2gif.c SEE ALSO
mpictures(6), picfile(9.6), quantize(9.1), PIC2PS(9.1)
All times are GMT -4. The time now is 12:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy