Sponsored Content
Full Discussion: Using GREP in IF Statement
Top Forums Shell Programming and Scripting Using GREP in IF Statement Post 302816275 by Ariean on Monday 3rd of June 2013 03:17:54 PM
Old 06-03-2013
I am ok with the colors as it kind of alerts me, by the way it indeed errored out when i execute the main script, i am trying to see why its happening.

syntax error: unexpected end of file
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using grep in if statement

Can somebody please guide me towards right syntax: #!/bin/ksh if i = $(grep $NAME filename) echo "Name Found" else echo " Name not Found" fi I need to grep for $NAME in the file, and if it returns false, execute a series of commands and if true, exit out. The above is not the right... (3 Replies)
Discussion started by: chiru_h
3 Replies

2. Shell Programming and Scripting

Using grep in a test/if statement

Okay, well this is more or less my first attempt at writing a shell script. Anyways, here's my code: cd ${PATH} if then rm ${FILE} ./anotherScript else exit 1 fi exit 1 Anyways, it's a pretty simple script that is supposed to search for the... (4 Replies)
Discussion started by: cbo0485
4 Replies

3. Shell Programming and Scripting

Swich statement based on a grep?

I'm piping the results of a tcpdump into a shell script and want certain commands executed (specifically the firing of an SNMP alert) based on a grep for certain contents in the output of tcpdump. For example, I have #!/bin/bash while read str; do grep 'ttl 64' -q && sudo snmptrap -v 1... (2 Replies)
Discussion started by: paulobrad
2 Replies

4. UNIX for Dummies Questions & Answers

grep entire statement not just line

(extract from SQL binlog file...) # at 4960 #080801 14:35:31 server id 4 end_log_pos 195 Query thread_id=63121426 exec_time=0 error_code=0 use d_jds; SET TIMESTAMP=1217581531; UPDATE bid_details set bidding = 3170.37 ,deduction=if((3170.37 < 37.43),0,deduction) where... (3 Replies)
Discussion started by: shantanuo
3 Replies

5. Shell Programming and Scripting

Grep statement

Hi All, Please can somebody advise that if I want to search a pattern xyz the grep command should only select xyz and not any other pattern containing xyz (ex abxyzcd) Regards (1 Reply)
Discussion started by: Shazin
1 Replies

6. Shell Programming and Scripting

sed / grep / for statement performance - please help

I'm searching the most effective way of doing the following task, so if someone can either provide a working solution with sed or one totally different but more effective then what I've got so far then please go ahead! The debugme directory has 3 subdirectorys and each of them has one .txt file... (7 Replies)
Discussion started by: TehOne
7 Replies

7. Shell Programming and Scripting

if statement with grep as conditional

Please see the script segment below for i in $files do echo $i if ; then case "$1" in "IE0263"|"IE0264"|"IE0267"|"IE0268") short_filename=`ls -l $i | cut -c108-136 | sort` ;; "IE0272"|"IE0273") short_filename=`ls -l $i | cut... (4 Replies)
Discussion started by: jmahal
4 Replies

8. Shell Programming and Scripting

Use awk/sed/grep with goto statement!

Hi, I have an array with characters and I am looking for specific character in that array and if those specific character not found than I use goto statment which is define somehwhere in the script. My code is: set a = (A B C D E F) @ i = 0 while ($i <= ${#a}) if ($a != "F" || $a != "D")... (3 Replies)
Discussion started by: dixits
3 Replies

9. UNIX for Dummies Questions & Answers

Grep Segmentation Fault If statement

I receive a segmentation fault on some servers when grepping a string, but not when I use -i, and vice-versa. I have googled this and realise it is usually a hardware / memory issue. I'd like to write an if statement that says "if grep string returns 'Segmentation fault' then grep the same... (4 Replies)
Discussion started by: MaindotC
4 Replies

10. Shell Programming and Scripting

Ps -ef|grep <processname> usage in IF statement

Hi, Am working in a filenet domain where we are using AIX as our terminal to run the jobs and schedule the shell scripts to run . In my previous post regarding the "Log modification with finding errors" ... (12 Replies)
Discussion started by: Kalaihari
12 Replies
smilint(1)							     SMI Tools								smilint(1)

NAME
smilint - syntax and semantic checks of SMIv1/v2 and SPPI modules SYNOPSIS
smilint [ -Vhersm ] [ -c file ] [ -p module ] [ -l level ] [ -i error-pattern ] module(s) DESCRIPTION
The smilint program is used to check MIB or PIB modules for syntax errors and semantics at some degree. SMIv1/v2 style MIB modules as well as SPPI PIB modules are supported. The rules that smilint is based on are taken from RFC 1155, RFC 1212 and RFC 1215 for SMIv1, RFCs 2578-2580 for SMIv2, RFC 3159 for SPPI. OPTIONS
-V, --version Show the smilint version and exit. -h, --help Show a help text and exit. -e, --error-list Show a list of all known error messages and exit. Error messages can have associated tags, shown in braces at the end of each line. The tags can be used with the -i option to ignore certain error messages. -r, --recursive Report errors and warnings also for recursively imported modules. -s, --severity Show the error severity in brackets before error messages. -m, --error-names Show the error names in braces before error messages. -c file, --config=file Read file instead of any other (global and user) configuration file. -p module, --preload=module Preload the module module before reading the main module(s). This may be helpful if an incomplete main module misses to import some definitions. -l level, --level=level Report errors and warnings up to the given severity level. See below for a description of the error levels. The default error level is 3. -i prefix, --ignore=prefix Ignore all errors that have a tag which matches prefix. A list of error tags can be retrieved by calling smilint with the -e option. module(s) These are the modules to be checked. If a module argument represents a path name (identified by containing at least one dot or slash character), this is assumed to be the exact file to read. Otherwise, if a module is identified by its plain module name, it is searched according to libsmi internal rules. See smi_config(3) for more details. ERROR AND WARNING LEVELS
All generated error and warning messages have an associated severity level. The actual severity levels are: 0 Internal error, no recovery possible. Examples are memory allocation failures. Errors of this level usually cause the application to abort. 1 Major SMI/SPPI error, recovery somehow possible but may lead to severe problems. Examples are lexically unexpected characters or unknown keywords. Errors of this kind usually lead to follow-on errors. 2 SMI/SPPI error which is probably tolerated by some implementations. Examples are MIB/PIB modules which mix constructs from different SMI/SPPI versions. 3 SMI/SPPI error which is likely tolerated by many implementations. Examples are misplaced SMIv2 MODULE-IDENTITY invocations or SMIv2 tex- tual conventions derived from other textual conventions. 4 Something which is not strictly an error but which is recommended to be changed. Warnings of this level are usually considered during MIB reviews. 5 Something that is basically correct but might be problematic in certain environments or usage scenarios. Examples are warnings that identifiers only differ in case or that type definitions are not used within the defining module. 6 Messages of this level are auxiliary notices. Examples are messages that point to a previous definition in case of a redefinition. Higher levels are currently not used and lead to the same effects as level 6 does. Note that errors up to level 3 are errors violating the specifications and must be fixed by the responsible author. The warnings generated with level 4 should be considered during normal MIB/PIB reviews. EXAMPLE
This example checks the file RMON2-MIB in the current directory (note that the `./' prefix ensures this). The error level is raised to 6 and warnings that claim about identifier names that exceed a length of 32 characters are suppressed. $ smilint -l 6 -i namelength-32 ./RMON2-MIB ./RMON2-MIB:3935: unexpected type restriction ./RMON2-MIB:3936: unexpected type restriction ./RMON2-MIB:3937: unexpected type restriction ./RMON2-MIB:3938: unexpected type restriction ./RMON2-MIB:3939: unexpected type restriction ./RMON2-MIB:3940: unexpected type restriction ./RMON2-MIB:4164: scalar object must not have a `read-create' access value SEE ALSO
The libsmi(3) project is documented at http://www.ibr.cs.tu-bs.de/projects/libsmi/. Other commonly used MIB checkers are mosy(1) and smicng(1). AUTHORS
(C) 1999-2004 F. Strauss, TU Braunschweig, Germany <strauss@ibr.cs.tu-bs.de> (C) 1999-2002 J. Schoenwaelder, TU Braunschweig, Germany <schoenw@ibr.cs.tu-bs.de> (C) 2002-2003 J. Schoenwaelder, University of Osnabrueck, Germany (C) 2003-2004 J. Schoenwaelder, International University Bremen, Germany (C) 2001-2002 T. Klie, TU Braunschweig, Germany <tklie@ibr.cs.tu-bs.de> (C) 2002 M. Bunkus, TU Braunschweig, Germany <bunkus@ibr.cs.tu-bs.de> and contributions by many other people. IBR
August 10, 2004 smilint(1)
All times are GMT -4. The time now is 06:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy