Sponsored Content
Full Discussion: regex inside if comparison
Top Forums Shell Programming and Scripting regex inside if comparison Post 302232079 by Annihilannic on Wednesday 3rd of September 2008 08:38:07 PM
Old 09-03-2008
Although personally I would do the comparison numerically anyway:

Code:
if [[ "$IP" -ge 110 && "$IP" -le 139 ]]; then

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

looping a array inside inside ssh is not working, pls help

set -A arr a1 a2 a3 a4 # START ssh -xq $Server1 -l $Username /usr/bin/ksh <<-EOS integer j=0 for loop in ${arr} do printf "array - ${arr}\n" (( j = j + 1 )) j=`expr j+1` done EOS # END ========= this is not giving me correct output. I... (5 Replies)
Discussion started by: reldb
5 Replies

2. Shell Programming and Scripting

Matching using Regex inside a file

I need scan through some files, then open the file one by one and scan inside the file using perl to see if it contain a start tag and end tag which the end tag is the mirror image of the start tag, the start tag and end tag only have 5 char. And inside the file there is "http://". It is just a... (5 Replies)
Discussion started by: blueblur
5 Replies

3. Shell Programming and Scripting

Converting perl regex to sed regex

I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly: if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies

4. Shell Programming and Scripting

String comparison not working inside while loop

Hi, In the code included below, the string comparision is not working fine. Please help while (( find_out >= i )) do file=`head -$i f.out|tail -1` dir=`dirname $file` cd $dir Status="" if ; then Status=`cvs -Q status... (3 Replies)
Discussion started by: sudvishw
3 Replies

5. Shell Programming and Scripting

string comparison not working inside while loop

The string comparison highlighted below is not working fine. Please help: while read line do # Get File name by deleting everything that preceedes and follows Filename as printed in cvs status' output f_name=`echo $line | sed -e 's/^File://' -e 's/ *Status:.*//' | awk '{print $NF}'` ... (4 Replies)
Discussion started by: sudvishw
4 Replies

6. UNIX for Dummies Questions & Answers

How to specify beginning-of-line/end-of-line characters inside a regex range

How can I specify special meaning characters like ^ or $ inside a regex range. e.g Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character. I tried the following but it does not work: sed 's/\(\)/<do something here>/g' file1 ... (3 Replies)
Discussion started by: jawsnnn
3 Replies

7. UNIX for Dummies Questions & Answers

read regex from ID file, print regex and line below from source file

I have a file of protein sequences with headers (my source file). Based on a list of IDs (which are included in some of the headers), I'd like to print out only the specified sequences, with only the ID as header. In other words, I'd like to search source.txt for the terms in IDs.txt, and print... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

8. Shell Programming and Scripting

Renumber position 88-94 inside all files matching criteria inside folder

There are 4 files inside one folder matching criteria i.e. File name = ABCJmdmfbsjopXXXXXXX_mm-dd-yyyy_XXX.data Here is the Code which find the files matching criteria:- TS=`date +"%m-%d-%Y"`| for fname in `find . -name "ABCJmdmfbsjop???????_${TS}*.data"` do # Matching File Processing Code.... (1 Reply)
Discussion started by: lancesunny
1 Replies

9. Shell Programming and Scripting

Perl, RegEx - Help me to understand the regex!

I am not a big expert in regex and have just little understanding of that language. Could you help me to understand the regular Perl expression: ^(?!if\b|else\b|while\b|)(?:+?\s+){1,6}(+\s*)\(*\) *?(?:^*;?+){0,10}\{ ------ This is regex to select functions from a C/C++ source and defined in... (2 Replies)
Discussion started by: alex_5161
2 Replies

10. Shell Programming and Scripting

Sendmail K command regex: adding exclusion/negative lookahead to regex -a@MATCH

I'm trying to get some exclusions into our sendmail regular expression for the K command. The following configuration & regex works: LOCAL_CONFIG # Kcheckaddress regex -a@MATCH +<@+?\.++?\.(us|info|to|br|bid|cn|ru) LOCAL_RULESETS SLocal_check_mail # check address against various regex... (0 Replies)
Discussion started by: RobbieTheK
0 Replies
CXREF(1)						      General Commands Manual							  CXREF(1)

NAME
cxref - cross reference C source files SYNOPSIS
cxref [ -FSCcfis ] [ -w width ] [files] DESCRIPTION
Cxref reads the named C source files and produces on the standard output a cross reference of all the identifiers and constants in the files. Constants are integer constants (12, 0421, 0x1A), floating point constants (123.45, 0.2e-4), string constants ("this is a string "), and character constants ('a', '33'). Identifiers, character constants, and string constants are sorted lexicographically, i.e. according to the machine collating sequence (7-bit ASCII on the Vax or the Pyramid). Integer and floating point constants are sorted numerically. The trailing 'l' or 'L' on long integer constants will not show up in the output listing. If no files are named, cxref reads the standard input. For multiple files, the argument "-" (a single dash) indicates that the standard input should be read at that point. If arguments are given, they must come before any file names. Cxref recognizes the following arguments: -F Fold case in comparison. By default, case is distinct in comparison of identifiers and string and character constants. (cxref simply passes the "-F" option on to sort(1) as "-f".) -S Cross reference all files separately. The default action is to cross reference all named files together. -c Leave character constants out of the cross reference listing. -f Leave floating point constants out of the cross reference listing. -i Leave integer constants out of the cross reference listing. -s Leave string constants out of the cross reference listing. -C Leave all constants, character, string, integer, and floating point, out of the cross reference listing. By default, all types of constants are included in the cross reference. -w width Make the output be width columns wide. The output width will never be less than 51 or more than 132 columns. Cxref silently adjusts incorrect settings to the nearest allowable setting. If no width is specified, the output will default to 80 columns wide. Cxref does not include #include files, or expand macro definitions. Files named in #include lines can be listed on the command line if they should also be cross referenced. If a quoted string has an escaped newline in it (see ``The C Programming Language'', page 181, or Section 2.5 of the C Reference Manual), it will show up inside the string in the output listing as N. This is to make it visible to the programmer, and to keep the various fil- ters which Cxref uses to actually do the work from getting terribly confused. Cxref is best run in the background, with its output redirected into a file or the line printer spooler lpr(1), since it reads all the named files, using sort(1) as an intermediate pass. The sorting can take time which the user can probably put to more productive use. DIAGNOSTICS
Self explanatory. BUGS
Systems running UNIX 4.0 and later already have a program named cxref. Therefore, on those systems, this program should be renamed. Cxref does not do any formatting on its output (other than to insure that it writes the proper number of columns), so it should probably be run piping its output into pr(1). Floating point constants are converted to a common format for sorting, therefore they may appear in the output in a format different from (but numerically equivalent to) their form in the original source code. SEE ALSO
lex(1), lpr(1), pr(1), sort(1) FILES
/tmp/cxr.$$.* temporary files for integer and floating point contstants. Cxref removes these files when it is through. AUTHOR
Arnold Robbins School of Information and Computer Science Georgia Institute of Technology Atlanta, Geogia 30332 UUCP: gatech!arnold CSNET: arnold@gatech ARPANET: arnold%gatech.csnet@csnet-relay.arpa Copyright (c) 1984 by Arnold Robbins. All rights reserved. This program may not be sold, but may be distributed provided this notice is included. Georgia Tech CXREF(1)
All times are GMT -4. The time now is 10:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy