Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Grep -P does not capture the desired output Post 303037229 by Corona688 on Friday 26th of July 2019 11:15:21 AM
Old 07-26-2019
Code:
$ awk -v RS="--------------------------------------------------------\n" -v FS="\n" '/Status:[ ]+[ABD-Z]/ { print RS,$0,RS }' input

--------------------------------------------------------
 Description:             hw_optics:  RX POWER LANE-0 LOW WARNING
Location:                 Optics0/0/0/21
AID:                     XR/HW_OPTICS/53
Tag String:              DEV_SFP_OPTICS_PORT_RX_POWER_LOW_WARNING_LANE0
Module Name:              Optics0/0/0/21
EID:                     PORT/OPTICS/21
Reporting Agent ID:      196678
Pending Sync:            false
Severity:                Minor
Status:                  Set
Group:                   Software
Set Time:                06/19/2019 05:01:23 UTC
Clear Time:              06/19/2019 23:54:24 UTC
Service Affecting:       NotServiceAffecting
Transport Direction:     NotSpecified
Transport Source:        NotSpecified
Interface:               N/A
Alarm Name:              OPTICS RX POWER LANE-0 LOW WARNING
 --------------------------------------------------------

$

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help me in getting the desired output

I wanted to put "|" this sign at starting and at end of every field but its not working with first field like Currently the out put is : abc | abc | abc | xyz | xyz | xyz | But I want the out put in this form: | abc | abc | abc | | xyz | xyz | xyz | plz help me. (2 Replies)
Discussion started by: akash
2 Replies

2. Shell Programming and Scripting

how to get desired output after redirection

hi i am running script which contains the commmnds and i am redirecting the script output to a file. like ./script 1> result.txt 2>&1 the above redirection is not working for commands when run in background in a script. but the problem here result.txt containg output which is repeated.... (3 Replies)
Discussion started by: raji
3 Replies

3. Solaris

How to grep (say)last-3 and next-3 lines of Desired Pattern

Hi All, OS-Type=Sun-OS 5.8 Sparc9 Processor Can I grep the previous 4 lines and next 4 lines of a matched pattern(context grep)? For example here we need to monitor logs of live traffic.The data obtained from "tail -f LiveTrafficData.log" looks something like this:-... (3 Replies)
Discussion started by: Sujan Banerjee
3 Replies

4. Shell Programming and Scripting

SED - output not desired

echo '0x3f 0xfa ae 0xeA' | sed '/0x/ y/abcdef/ABCDEF/' output: 0x3F 0xFA AE 0xEA echo '0x3f 0xfa ae 0xeA' | sed -r '/0x{2}/ y/abcdefg/ABCDEFG/' output: 0x3F 0xFA AE 0xEA my expected output: 0x3F 0xFA ae 0xEA What I want to achieve is change all hexadecimals to UPPER case(only those... (6 Replies)
Discussion started by: kevintse
6 Replies

5. Shell Programming and Scripting

Need your help to get the output of the list in desired format

Hello Guys, I am working on a script and using the below code to fetch the list of all repositories CHDIR='/mnt/scm/subversion/' repolist() { cd ${CHDIR} Repo=`ls|cut -d " " -f1` echo $Repo } Output of the above code is BSB CIB COB DCI DIB DSB ESB-P ESB-TOOLS FareVerify GCACHE GWY... (15 Replies)
Discussion started by: rohit22hamirpur
15 Replies

6. Shell Programming and Scripting

need to get the desired output

Below is the my cide which is working fine but I am not getting the output indesired format.there is some problem in alignment.Can someone help me to correct this? if ]; then summary=$( echo -e "Please review the log file of auto coloclean utility.\n"; echo -e... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

7. Shell Programming and Scripting

How to grep the desired output and output to a file?

currently I have process from a raw file to this stage ALTER TABLE "EXCEL_ADMIN"."TC_TXN_VOID" ADD CONSTRAINT "PK_TC_TXN_VOID" PRIMARY KEY ("TC_TXN_IID") ALTER TABLE "EXCEL_ADMIN"."TC_TXN_AMT" ADD CONSTRAINT "PK_TC_TXN_AMT" PRIMARY KEY ("TC_TXN_AMT_IID") ALTER TABLE... (10 Replies)
Discussion started by: jediwannabe
10 Replies

8. Shell Programming and Scripting

Help!! needed to get the desired output

Am in need of your help to get the desired output. nameSECURITY.SERVICES.CONFIG:GETVALUEisPrefetchedNsAccessLast2013-09-13 10:50:13 MESTsAccessTotal1sRunningcHitLastnamePUBLIC.SERVER:INVOKEisPrefetchedNsAccessLast2013-09-17 15:02:05... (5 Replies)
Discussion started by: rocky2013
5 Replies

9. Shell Programming and Scripting

Output not coming as desired.

Hi guys. I have a file containing some hosts and their IPs. host host1 192.168.2.10 host host2 192.168.2.11 host host3 192.168.2.12 I am writing a script where I want to print these values in 1 line. My script looks like RUNTIME_NODE=`cat hosts.properties | grep host` for i in... (7 Replies)
Discussion started by: Junaid Subhani
7 Replies

10. Shell Programming and Scripting

Pgrep not showing desired output

I am searching for a process that should be up and running. Im using the following command ps -ef | grep elasticsearch to get elastic+ 1673 1 0 Jan29 ? 05:08:56 /bin/java -Xms4g -Xmx4g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC... (1 Reply)
Discussion started by: Junaid Subhani
1 Replies
install::TempContent::Objects::mod_perl-2.0.9::docs::apiUseraContributinstall::TempContent::Objects::mod_perl-2.0.9::docs::api::Apache2::Status(3)

NAME
Apache2::Status - Embedded interpreter status information Synopsis <Location /perl-status> # disallow public access Order Deny, Allow Deny from all Allow from 127.0.0.1 SetHandler modperl PerlOptions +GlobalRequest PerlResponseHandler Apache2::Status </Location> or <Location /perl-status> # disallow public access Order Deny, Allow Deny from all Allow from 127.0.0.1 SetHandler perl-script PerlResponseHandler Apache2::Status </Location> Description The "Apache2::Status" module provides some information about the status of the Perl interpreter embedded in the server. Configure like so: <Location /perl-status> # disallow public access Order Deny, Allow Deny from all Allow from 127.0.0.1 SetHandler modperl PerlOptions +GlobalRequest PerlResponseHandler Apache2::Status </Location> Notice that under the "modperl" core handler the Environment menu option will show only the environment under that handler. To see the environment seen by handlers running under the "perl-script" core handler, configure "Apache2::Status" as: <Location /perl-status> # disallow public access Order Deny, Allow Deny from all Allow from 127.0.0.1 SetHandler perl-script PerlResponseHandler Apache2::Status </Location> Other modules can "plugin" a menu item like so: require Apache2::Module; Apache2::Status->menu_item( 'DBI' => "DBI connections", #item for Apache::DBI module sub { my ($r, $q) = @_; #request and CGI objects my (@strings); push @strings, "blobs of html"; return @strings; #return an array ref } ) if Apache2::Module::loaded('Apache2::Status'); WARNING: "Apache2::Status" must be loaded before these modules via the "PerlModule" or "PerlRequire" directives (or from startup.pl). A very common setup might be: Perl Module B::TerseSize <Location /perl-status> SetHandler perl-script PerlResponseHandler Apache2::Status PerlSetVar StatusOptionsAll On PerlSetVar StatusDeparseOptions "-p -sC" </Location> due to the implementation of Apache2::Status::noh_fileline in B::TerseSize, you must load B::TerseSize first. Options "StatusOptionsAll" This single directive will enable all of the options described below. PerlSetVar StatusOptionsAll On "StatusDumper" When browsing symbol tables, the values of arrays, hashes and scalars can be viewed via "Data::Dumper" if this configuration variable is set to "On": PerlSetVar StatusDumper On "StatusPeek" With this option "On" and the "Apache::Peek" module installed, functions and variables can be viewed ala "Devel::Peek" style: PerlSetVar StatusPeek On "StatusLexInfo" With this option "On" and the "B::LexInfo" module installed, subroutine lexical variable information can be viewed. PerlSetVar StatusLexInfo On "StatusDeparse" With this option "On" subroutines can be "deparsed". PerlSetVar StatusDeparse On Options can be passed to "B::Deparse::new" like so: PerlSetVar StatusDeparseOptions "-p -sC" See the "B::Deparse" manpage for details. "StatusTerse" With this option "On", text-based op tree graphs of subroutines can be displayed, thanks to "B::Terse". PerlSetVar StatusTerse On "StatusTerseSize" With this option "On" and the "B::TerseSize" module installed, text-based op tree graphs of subroutines and their size can be displayed. See the "B::TerseSize" docs for more info. PerlSetVar StatusTerseSize On "StatusTerseSizeMainSummary" With this option "On" and the "B::TerseSize" module installed, a "Memory Usage" will be added to the "Apache2::Status" main menu. This option is disabled by default, as it can be rather cpu intensive to summarize memory usage for the entire server. It is strongly suggested that this option only be used with a development server running in "-X" mode, as the results will be cached. PerlSetVar StatusTerseSizeMainSummary On "StatusGraph" When "StatusDumper" is enabled, another link "OP Tree Graph" will be present with the dump if this configuration variable is set to "On": PerlSetVar StatusGraph This requires the B module (part of the Perl compiler kit) and "B::Graph" (version 0.03 or higher) module to be installed along with the "dot" program. Dot is part of the graph visualization toolkit from AT&T: http://www.graphviz.org/. WARNING: Some graphs may produce very large images, some graphs may produce no image if "B::Graph"'s output is incorrect. "Dot" Location of the dot program for "StatusGraph", if other than /usr/bin or /usr/local/bin "GraphDir" Directory where "StatusGraph" should write it's temporary image files. Default is "$ServerRoot/logs/b_graphs". Prerequisites The "Devel::Symdump" module, version 2.00 or higher. Other optional functionality requirements: "B::Deparse" - 0.59, "B::Fathom" - 0.05, ""B::Graph"" - 0.03. Copyright mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0. See Also perl(1), Apache(3), Devel::Symdump(3), Data::Dumper(3), B(3), "B::Graph"(3), mod_perl 2.0 documentation. Authors Doug MacEachern with contributions from Stas Bekman perl v5.18.2 20install::TempContent::Objects::mod_perl-2.0.9::docs::api::Apache2::Status(3)
All times are GMT -4. The time now is 12:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy