Sponsored Content
Full Discussion: A script need help
Top Forums Shell Programming and Scripting A script need help Post 303039358 by green_k on Tuesday 1st of October 2019 11:10:59 PM
Old 10-02-2019
A script need help

Hi Gurus,
I have below requirement and have no idea how to achieve this.
the input file like below. there are multiple sections in file, each section has multiple lines. I need to find certain lines (value1, value2, value3 are key words for line searching) and generate another file. in some section, maybe some lines missing. for missing line, output "Missing"
My OS is SunOS 5.10 Generic_150400-64 sun4v sparc sun4v
Code:
[section_abc]
xxxxx
xxxx
CITY=ABC
REGION=CDE
STREET=EFG
[section_cde]
xxxxx
xxxx
CITY=xyz
REGION=123
STREET=345
[section_efg]
xxxxx
xxxx
CITY=900
REGION=200
[section_ghi]
xxxxx
xxxx
REGION=500
STREET=600

expected output file like below:

Code:
[section_abc] CITY=ABC REGION=CDE STREET=EFG
[section_cde] CITY=xyz REGION=123 STREET=345
[section_efg] CITY=900 REGION=200 MISSING 
[section_ghi] missing    REGION=500 STREET=600

thanks in advance

Last edited by green_k; 10-02-2019 at 01:07 AM..
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

2. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

4. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

5. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
Info::Layer3::N1600(3pm)				User Contributed Perl Documentation				  Info::Layer3::N1600(3pm)

NAME
SNMP::Info::Layer3::N1600 - SNMP Interface to Nortel 16XX Network Devices AUTHOR
Eric Miller SYNOPSIS
# Let SNMP::Info determine the correct subclass for you. my $n1600 = new SNMP::Info( AutoSpecify => 1, Debug => 1, DestHost => 'myswitch', Community => 'public', Version => 1 ) or die "Can't connect to DestHost. "; my $class = $n1600->class(); print "SNMP::Info determined this device to fall under subclass : $class "; DESCRIPTION
Provides abstraction to the configuration information obtainable from a Nortel N16XX device through SNMP. For speed or debugging purposes you can call the subclass directly, but not after determining a more specific class using the method above. my $n1600 = new SNMP::Info::Layer3::N1600(...); Inherited Classes SNMP::Info::Layer3 SNMP::Info::SONMP Required MIBs SWL2MGMT-MIB RAPID-CITY Inherited Classes' MIBs See classes listed above for their required MIBs. GLOBALS
These are methods that return scalar value from SNMP $n1600->bulkwalk_no Return 1. Bulkwalk is currently turned off for this class. $n1600->model() Returns model type. Checks $n1600->id() against the RAPID-CITY-MIB and then parses out "rcA". $n1600->vendor() Returns 'nortel' $n1600->os() Returns 'passport' $n1600->os_ver() Returns os version extracted from "sysDescr". Overrides $n1600->index_factor() Required by SNMP::Info::SONMP. Number representing the number of ports reserved per slot within the device MIB. Returns 64 since largest switch has 48 ports. Since these switches can not stack, the only requirement to reserve more than the max number of ports. Globals imported from SNMP::Info::Layer3 See documentation in "GLOBALS" in SNMP::Info::Layer3 for details. Globals imported from SNMP::Info::SONMP See documentation in SNMP::SONMP::Layer3 for details. TABLE METHODS
These are methods that return tables of information in the form of a reference to a hash. Overrides $n1600->interfaces() Returns reference to hash of interface names to iids. Places a 1 in front of index number. This is required for compatibility with SNMP::Info::SONMP. $n1600->i_duplex() Returns reference to hash of interface operational link duplex status. $n1600->i_duplex_admin() Returns reference to hash of interface administrative link duplex status. Table Methods imported from SNMP::Info::Layer3 See documentation in "TABLE METHODS" in SNMP::Info::Layer3 for details. Table Methods imported from SNMP::Info::SONMP See documentation in "TABLE METHODS" in SNMP::Info::SONMP for details. perl v5.12.4 2011-09-28 Info::Layer3::N1600(3pm)
All times are GMT -4. The time now is 04:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy