Sponsored Content
Top Forums UNIX for Advanced & Expert Users How to prevent grep command from throwing a system trap if No match is found. Post 302274790 by Yegolev on Thursday 8th of January 2009 11:22:04 AM
Old 01-08-2009
My first guess is to test for existence first, then do the part that bothers you without the trap.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I prevent cron from returning errors on a file not found?

find: /home/Upload/*: No such file or directory I am getting a find error when I run for FILE in `find /home/Upload/* -prune -type f -newer TIMEFILE` do I need to run this job every 10 minutes to upload any new files that were added. Is there an easy way to prevent this? Thanks (6 Replies)
Discussion started by: goodmis
6 Replies

2. UNIX for Dummies Questions & Answers

Grep and display n lines after the match is found.

Hello, How do I use grep to find a pattern in a list of file and then display 5 lines after the pattern is matched Eg: I want to match the string GetPresentCode in all files in a folder and then see 4 lines following this match. I am not sure if grep is what should be used to achieve. Thanks!... (3 Replies)
Discussion started by: cv_pan
3 Replies

3. Shell Programming and Scripting

fetch last line no form file which is match with specific pattern by grep command

Hi i have a file which have a pattern like this Nov 10 session closed Nov 10 Nov 9 08:14:27 EST5EDT 2010 on tty . Nov 10 Oct 19 02:14:21 EST5EDT 2010 on pts/tk . Nov 10 afrtetryytr Nov 10 session closed Nov 10 Nov 10 03:21:04 EST5EDT 2010 Dec 8 Nov 10 05:03:02 EST5EDT 2010 ... (13 Replies)
Discussion started by: Himanshu_soni
13 Replies

4. Shell Programming and Scripting

sendmail script throwing an error "No recipient addresses found in header"

Hi, I am using following code to send an e-mail with attachment and body. echo "To: user1@mail.com,user2@mail.com" > mail.tmp echo "Cc: user3@mail.com,user4@mail.com" >> mail.tmp echo "From: group@mail.com" >> mail.tmp echo "Subject: my report" >> mail.tmp echo "please see as attached"... (6 Replies)
Discussion started by: vivek_damodaran
6 Replies

5. Shell Programming and Scripting

kill a process if grep match is found

Hi, I need something unusual, I guess. I need to start a process, and if that process displays a specific error message, I need to kill that process and restart it. Something like: startprocess | grep -i "This is the specific error message" && kill $pidof(startprocess) Explanation, I need... (4 Replies)
Discussion started by: burek
4 Replies

6. UNIX for Dummies Questions & Answers

awk display the match and 2 lines after the match is found.

Hello, can someone help me how to find a word and 2 lines after it and then send the output to another file. For example, here is myfile1.txt. I want to search for "Error" and 2 lines below it and send it to myfile2.txt I tried with grep -A but it's not supported on my system. I tried with awk,... (4 Replies)
Discussion started by: eurouno
4 Replies

7. Shell Programming and Scripting

Grep everything between two pattern if match not found

I need to help to work this Print everything between 2 patterns if grep is not found the search word example Detroit orange cat bat rat apple sed -n "/Detroit,/apple/p" d |grep chicago output would be Detroit orange cat bat rat (1 Reply)
Discussion started by: jhonnyrip
1 Replies

8. Shell Programming and Scripting

Bash - trap error file not found

Hello. In bash, is there a way to trap error "file not found" when a script call another script which is not found; then abort. Example ( part of script running with -x option set) : + return 0 + RETURN_CODE=0 + ] + /root/bin/200_yast_install/00_reset_yast_install bash:... (5 Replies)
Discussion started by: jcdole
5 Replies

9. Shell Programming and Scripting

Grep command to search a regular expression in a line an only print the string after the match

Hello, one step in a shell script i am writing, involves Grep command to search a regular expression in a line an only print the string after the match an example line is below /logs/GRAS/LGT/applogs/lgt-2016-08-24/2016-08-24.8.log.zip:2016-08-24 19:12:48,602 ERROR... (9 Replies)
Discussion started by: Ramneekgupta91
9 Replies
SNMPTRAP(1)							     Net-SNMP							       SNMPTRAP(1)

NAME
snmptrap, snmpinform - sends an SNMP notification to a manager SYNOPSIS
snmptrap -v 1 [COMMON OPTIONS] [-Ci] enterprise-oid agent generic-trap specific-trap uptime [OID TYPE VALUE]... snmptrap -v [2c|3] [COMMON OPTIONS] [-Ci] uptime trap-oid [OID TYPE VALUE]... snmpinform -v [2c|3] [COMMON OPTIONS] uptime trap-oid [OID TYPE VALUE]... DESCRIPTION
snmptrap is an SNMP application that uses the SNMP TRAP operation to send information to a network manager. One or more object identifiers (OIDs) can be given as arguments on the command line. A type and a value must accompany each object identifier. Each variable name is given in the format specified in variables(5). When invoked as snmpinform, or when -Ci is added to the command line flags of snmptrap, it sends an INFORM-PDU, expecting a response from the trap receiver, retransmitting if required. Otherwise it sends an TRAP-PDU or TRAP2-PDU. If any of the required version 1 parameters, enterprise-oid, agent, and uptime are specified as empty, it defaults to 1.3.6.1.4.1.3.1.1 (enterprises.cmu.1.1), hostname, and host-uptime respectively. The TYPE is a single character, one of: i INTEGER u UNSIGNED c COUNTER32 s STRING x HEX STRING d DECIMAL STRING n NULLOBJ o OBJID t TIMETICKS a IPADDRESS b BITS which are handled in the same way as the snmpset command. For example: snmptrap -v 1 -c public manager enterprises.spider test-hub 3 0 '' interfaces.iftable.ifentry.ifindex.1 i 1 will send a generic linkUp trap to manager, for interface 1. OPTIONS
snmptrap takes the common options described in the snmpcmd(1) manual page in addition to the -Ci option described above. SEE ALSO
snmpcmd(1), snmpset(1), variables(5). 4th Berkeley Distribution 08 Feb 2002 SNMPTRAP(1)
All times are GMT -4. The time now is 11:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy