Sponsored Content
Full Discussion: Shell Script Extraction
Special Forums UNIX and Linux Applications Infrastructure Monitoring Shell Script Extraction Post 302429696 by clx on Tuesday 15th of June 2010 07:39:28 AM
Old 06-15-2010
strange!!
What is the source of the file? did you transfer the file from dos/windows?


re-create the file with the same contents just to test.
if you having dos2unix utility, try that.

what is what I tried with your file,
Code:
$ cat juniper-MPLS-MIB.sev.snmptrap.lookup 
table juniper-MPLS-MIB_sev =
{
{"SNMPTRAP-juniper-MPLS-MIB-mplsLspUp","1","2","0"},
{"SNMPTRAP-juniper-MPLS-MIB-mplsLspDown","3","1","0"},
{"SNMPTRAP-juniper-MPLS-MIB-mplsLspChange","2","13","1800"},
{"SNMPTRAP-juniper-MPLS-MIB-mplsLspPathDown","3","1","0"},
{"SNMPTRAP-juniper-MPLS-MIB-mplsLspPathUp","1","2","0"},
{"SNMPTRAP-juniper-MPLS-MIB-mplsLspInfoUp","1","2","0"},
{"SNMPTRAP-juniper-MPLS-MIB-mplsLspInfoDown","3","1","0"},
{"SNMPTRAP-juniper-MPLS-MIB-mplsLspInfoChange","2","13","1800"},
{"SNMPTRAP-juniper-MPLS-MIB-mplsLspInfoPathDown","3","1","0"},
{"SNMPTRAP-juniper-MPLS-MIB-mplsLspInfoPathUp","1","2","0"}
}
default = {"Unknown","Unknown","Unknown"}
 
$ awk -F \" '/^\{"SNMPTRAP/{print $2}' *.sev.*.lookup
SNMPTRAP-juniper-MPLS-MIB-mplsLspUp
SNMPTRAP-juniper-MPLS-MIB-mplsLspDown
SNMPTRAP-juniper-MPLS-MIB-mplsLspChange
SNMPTRAP-juniper-MPLS-MIB-mplsLspPathDown
SNMPTRAP-juniper-MPLS-MIB-mplsLspPathUp
SNMPTRAP-juniper-MPLS-MIB-mplsLspInfoUp
SNMPTRAP-juniper-MPLS-MIB-mplsLspInfoDown
SNMPTRAP-juniper-MPLS-MIB-mplsLspInfoChange
SNMPTRAP-juniper-MPLS-MIB-mplsLspInfoPathDown
SNMPTRAP-juniper-MPLS-MIB-mplsLspInfoPathUp
$

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help with data extraction script

Hello all, Iam newbie here and to unix programming. I have the following text file. A:Woshington,B:London,C:Paris,D:Manchester,C:Lisbon,E:Cape town. Now I would like extract this and store in database. here is the script I have tried but it did work. CITY1:`echo "$text" | grep "A:"... (11 Replies)
Discussion started by: mam
11 Replies

2. Shell Programming and Scripting

Shell script for text extraction from a file

Hi All, I am new to Shell Scripting. I have a file consisting of XML messages.Each message is associated with a timestamp value(it is not a xml field).I need to extract\copy all messages in a particular time interval and put in another new file using Shell Scripting. My XML looks like... (3 Replies)
Discussion started by: vignesh53
3 Replies

3. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

4. Shell Programming and Scripting

Date and time range extraction via Awk or analysis script?

Hello does anyone know of an awk that will extract log file entries between a specific date and time range, eg: awk '/15\/Dec\/2010:16:10:00/, /15\/Dec\/2010:16:15:00/' access_log but one that works? Or a free command line log file analysis tool/script? I'd like to be able to view... (2 Replies)
Discussion started by: competitions
2 Replies

5. Shell Programming and Scripting

Pattern extraction and usage by shell script

Suppose im in a directory A. which has sub-directories x/y/z m/n/p etc. Iam only considered with those which have a file netl.oa at the lowermost level. So i used the find command which gives me a list in the form ./abc/def/ghi/jkl/netl.oa and so on Now i want the names abc def jkl and ghi. My... (3 Replies)
Discussion started by: sid.verycool
3 Replies

6. Shell Programming and Scripting

Correct shell script to Call One shell script from another shell script

Hi All, I have new for shell scripting. Problem : I have one scrip at serv1 and path of server is /apps/dev/provimage/scripts and script name:extract_ancillary.bat. I need to call this script at server2(my working server) and execute at server2 . Please let me know how to build the... (5 Replies)
Discussion started by: Vineeta Nigam
5 Replies

7. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

8. UNIX for Dummies Questions & Answers

How to write Config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

9. Shell Programming and Scripting

How to write config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

10. UNIX for Beginners Questions & Answers

Script for extraction of pattern

Anyone can help here, with a script to extract the highlighted details from this two blocks?Actually there are milions of block, this is a sample? dn: EpsStaInfId=EpsStaInf,serv=EPS,mscId=aaaaaa001aaaaaaaa629100100138702,ou=multiSCs,dc=mtncg structuralObjectClass: EpsStaticInf objectClass:... (19 Replies)
Discussion started by: gillesi
19 Replies
Info::Layer3::Juniper(3pm)				User Contributed Perl Documentation				Info::Layer3::Juniper(3pm)

NAME
SNMP::Info::Layer3::Juniper - SNMP Interface to L3 Juniper Devices AUTHOR
Bill Fenner SYNOPSIS
# Let SNMP::Info determine the correct subclass for you. my $juniper = new SNMP::Info( AutoSpecify => 1, Debug => 1, DestHost => 'myrouter', Community => 'public', Version => 2 ) or die "Can't connect to DestHost. "; my $class = $juniper->class(); print "SNMP::Info determined this device to fall under subclass : $class "; DESCRIPTION
Subclass for Generic Juniper Routers running JUNOS Inherited Classes SNMP::Info::Layer3 SNMP::Info::LLDP Required MIBs Inherited Classes' MIBs See "Required MIBs" in SNMP::Info::Layer3 for its own MIB requirements. See "Required MIBs" in SNMP::Info::LLDP for its own MIB requirements. GLOBALS
These are methods that return scalar value from SNMP $juniper->vendor() Returns 'juniper' $juniper->os() Returns 'junos' $juniper->os_ver() Returns the software version extracted from "sysDescr". $juniper->model() Returns the model from "sysObjectID", with "jnxProductNameremoved" from the beginning. $juniper->serial() Returns serial number ("jnxBoxSerialNo.0") $juniper->hasCDP() Returns whether LLDP is enabled. Globals imported from SNMP::Info::Layer3 See documentation in "GLOBALS" in SNMP::Info::Layer3 for details. Global Methods imported from SNMP::Info::LLDP See documentation in "GLOBALS" in SNMP::Info::LLDP for details. TABLE METHODS
These are methods that return tables of information in the form of a reference to a hash. $juniper->i_vlan() Returns the list of interfaces whose "ifType" is l2vlan(135), and the VLAN ID extracted from the interface description. $juniper->c_id() Returns LLDP information. $juniper->c_if() Returns LLDP information. $juniper->c_ip() Returns LLDP information. $juniper->c_platform() Returns LLDP information. $juniper->c_port() Returns LLDP information. Forwarding Table ("dot1dTpFdbEntry") $juniper->fw_mac() Returns reference to hash of forwarding table MAC Addresses ("dot1dTpFdbAddress") $juniper->fw_port() Returns reference to hash of forwarding table entries port interface identifier (iid) ("dot1dTpFdbPort") Table Methods imported from SNMP::Info::Layer3 See documentation in "TABLE METHODS" in SNMP::Info::Layer3 for details. Table Methods imported from SNMP::Info::LLDP See documentation in "TABLE METHODS" in SNMP::Info::LLDP for details. perl v5.12.4 2011-09-28 Info::Layer3::Juniper(3pm)
All times are GMT -4. The time now is 10:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy