Sponsored Content
Top Forums Shell Programming and Scripting shell or perl script using grep and regex Post 302676511 by Corona688 on Tuesday 24th of July 2012 05:07:10 PM
Old 07-24-2012
regexes cannot understand ip/subnet ranges because they have no concept of numbers, let alone arithmetic.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

regex/shell script to Parse through XML Records

Hi All, I have been working on something that doesn't seem to have a clear regex solution and I just wanted to run it by everyone to see if I could get some insight into the method of solving this problem. I have a flat text file that contains billing records for users, however the records... (5 Replies)
Discussion started by: Jerrad
5 Replies

2. Shell Programming and Scripting

Checking the password thru Regex via Shell Script

All, I'm new to shell script. How do I check the password 1)password should have atleast one alpha character and one non-alpha character (0-9 Special) 2)password should not contain three or more repeated alpha numeric characters in a row Can somebody help me in creating the regular... (1 Reply)
Discussion started by: gudikal_karanam
1 Replies

3. UNIX for Dummies Questions & Answers

| help | unix | grep (GNU grep) 2.5.1 | advanced regex syntax

Hello, I'm working on unix with grep (GNU grep) 2.5.1. I'm going through some of the newer regex syntax using Regular Expression Reference - Advanced Syntax a guide. ls -aLl /bin | grep "\(x\)" Which works, just highlights 'x' where ever, when ever. I'm trying to to get (?:) to work but... (4 Replies)
Discussion started by: MykC
4 Replies

4. Shell Programming and Scripting

Shell script regex help: accept only 3 file extensions

This regex is supposed to accept files with extensions 270, 276, and "txt" only. Everything else should be discarded. This is what I have. I'll spare you the rest of the code. ext =".\$" #ext =".\$" #ext =".\$" #ext =".\$" for xfile in `ls $dir | grep "$ext" | xargs`; do... (9 Replies)
Discussion started by: grep01
9 Replies

5. 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

6. Shell Programming and Scripting

Need regex shell script to remove text from file

Hello I am trying to remove a line like <?php /*versio:2.05*/if (!defined('determinator')){ content goes here}?> Now i want to scan all... (6 Replies)
Discussion started by: devp
6 Replies

7. Shell Programming and Scripting

netstat grep regex suspend script help

Hi I am trying to create a suspend script which will suspend the system only if it cant find port 9982 four or more times OR 192.168.0.:microsoft-ds ESTABLISHED in the output of netstat -t. I am struggling with the 9982 bit, googling etc I came up with if netstat -t|grep -P "(9982){4,}" ... (15 Replies)
Discussion started by: bilboNIX
15 Replies

8. 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

9. UNIX for Beginners Questions & Answers

Help with understanding this regex in a Perl script parsing a 'complex' string

Hi, I need some guidance with understanding this Perl script below. I am not the author of the script and the author has not leave any documentation. I supposed it is meant to be 'easy' if you're a Perl or regex guru. I am having problem understanding what regex to use :confused: The script does... (3 Replies)
Discussion started by: newbie_01
3 Replies

10. UNIX for Beginners Questions & Answers

Generation of Regex for Perl script

I want to generate regex for this kind of expression and want to find and replace. like : ----> basically i want to find anything that match a pattern like this and remove the whole thing Please looking for some suggestions (1 Reply)
Discussion started by: utkarshkhanna44
1 Replies
IPSEC_GOODMASK(3)					     Library Functions Manual						 IPSEC_GOODMASK(3)

NAME
ipsec_goodmask, ipsec_masktobits, ipsec_bitstomask - check if Internet subnet mask is valid, convert Internet subnet mask to bit count, convert bit count to Internet subnet mask SYNOPSIS
#include <freeswan.h> int goodmask(struct in_addr mask); int masktobits(struct in_addr mask); struct in_addr bitstomask(int n); DESCRIPTION
These functions are obsolete; see ipsec_masktocount(3) for a partial replacement. Goodmask reports whether the subnet mask is a valid one, i.e. consists of a (possibly empty) sequence of 1s followed by a (possibly empty) sequence of 0s. Masktobits takes a (valid) subnet mask and returns the number of 1 bits in it. Bitstomask reverses this, returning the subnet mask corresponding to bit count n. All masks are in network byte order. SEE ALSO
inet(3), ipsec_atosubnet(3) DIAGNOSTICS
Masktobits returns -1 for an invalid mask. Bitstomask returns an all-zeros mask for a negative or out-of-range n. HISTORY
Written for the FreeS/WAN project by Henry Spencer. BUGS
The error-reporting convention of bitstomask is less than ideal; zero is sometimes a legitimate mask. 11 June 2001 IPSEC_GOODMASK(3)
All times are GMT -4. The time now is 09:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy