Search Results

Search: Posts Made By: gencon
7,722
Posted By Don Cragun
While doing some further testing, I came up with...
While doing some further testing, I came up with a few questions. If you had the following input file:
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28
11.22.33.44version...
7,722
Posted By Chubler_XL
No need to feel guilty I have a feeling I'm much...
No need to feel guilty I have a feeling I'm much better at solving problems than explaining what I mean, my wife says I the most left-brained person she knows.

On your RegEx performance testing.
...
7,722
Posted By Don Cragun
I apologize for taking so long to get back to...
I apologize for taking so long to get back to you. But when I have a choice between spending some time with the grandkids or evaluating an awk script; the grandkids are going to win every time. :)...
7,722
Posted By Chubler_XL
The code ipUnique[ip] = ip; and ipUnique[ip]; are...
The code ipUnique[ip] = ip; and ipUnique[ip]; are not equivalent.

The first creates array element ip with a null value (if it doesn't already exist) and then assigns it's value to ip.

The...
7,722
Posted By Scrutinizer
Actually, interval expressions for awk are part...
Actually, interval expressions for awk are part of POSIX (at least since SUS v3):
9.4.6 EREs Matching Multiple Characters...
7,722
Posted By Don Cragun
I didn't notice when you slipped in local in your...
I didn't notice when you slipped in local in your variable definitions; local isn't in the POSIX standards. (A proposal to add local to a future revision of the POSIX standards is being discussed. ...
7,722
Posted By Don Cragun
Hi gencon and Chubler_XL, I agree that...
Hi gencon and Chubler_XL,
I agree that Chubler_XL is taking the better approach. There is no need to fire up both sed and awk. You just need to fix the gsub() that is accidentally deleting all...
7,722
Posted By Chubler_XL
No, that is an attempt to remove the need for the...
No, that is an attempt to remove the need for the sed replace call it is supposed to match slash + ipRegEx + slash.
Perhaps it would be clearer if we replaced it with something like...
7,722
Posted By Chubler_XL
Perhaps you could get some more portability out...
Perhaps you could get some more portability out of an awk script (you could also test the 0-255 limit on the octets with this awk script if you liked):

local ipLikeAddressMatches=$(awk '
BEGIN {...
7,722
Posted By Don Cragun
I'm over it. No intensive therapy required. ...
I'm over it. No intensive therapy required.

Note that I clearly stated that my suggestion had a limitation because I knew it didn't work with one of your sample lines of input. (It seemed to...
7,722
Posted By Chubler_XL
If you every did have a ip and ip-like addresses...
If you every did have a ip and ip-like addresses sed could just blank out the ip-like ones in this manor:

skipIpExpr1="[/][0-9]+\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]+[/]"...
7,722
Posted By RudiC
I can't see what's going wrong. Did you try...
I can't see what's going wrong. Did you try alternation of [^/] with the begin-of-line (^)?
7,722
Posted By disedorgue
Hi, Or, if your grep have -P option, you can...
Hi,
Or, if your grep have -P option, you can reduct one regex:
$ cat file
a) "11.11.11.11" --> This should match "11.11.11.11"
b) "lots12.11.11.11lots" --> This should match...
7,722
Posted By Don Cragun
As long as you don't have input lines that...
As long as you don't have input lines that contain both an ip address and an ip-like address between slash characters, the following seems to do what you want:...
6,440
Posted By Don Cragun
Hi gencon, I'm glad it helped. It is a...
Hi gencon,
I'm glad it helped.

It is a personal preference. In the shell, the meaning of (pattern) and pattern) is exactly the same. I prefer the (pattern) form because I use the vi editor...
6,440
Posted By Don Cragun
Hi gencon, As Corona688 said, the getopts...
Hi gencon,
As Corona688 said, the getopts utility is used to parse command line options. When the getopts loop finishes, you should shift off the arguments that it processed and the remaining...
6,440
Posted By Corona688
How is it supposed to tell the difference between...
How is it supposed to tell the difference between a missing -, and a filename named 'x' that the user wants to enter? What if the user really does want to enter a file named x? It can't, its...
6,883
Posted By Scrutinizer
Glad it helps :) Note: FS="**" only works in...
Glad it helps :)

Note: FS="**" only works in some awks, where it may happen to mean "zero or more asterisks" .

However, this is not defined behaviour..



So it would be best to either...
6,883
Posted By Scrutinizer
The input field separator in awk needs to be...
The input field separator in awk needs to be specified before the first line. It is also probably a good idea to remove the special meaning of the asterisks. Try:
awk -F' ' '{printf ....
4,384
Posted By Scrutinizer
It might be that there is some special character...
It might be that there is some special character involved? Have you tried using grep -F?

Otherwise, could you provide a sample of what goes wrong?
4,384
Posted By MadeInGermany
Use [^[:ascii:]] instead! To match a space or a...
Use [^[:ascii:]] instead!
To match a space or a non-breaking space, try [^[:graph:]].
4,384
Posted By MadeInGermany
LANG sets locale, and has an impact on character...
LANG sets locale, and has an impact on character sets like [a-z] or [[:print:]].
2,495
Posted By Corona688
$ cat data This line contains a 1 but is not...
$ cat data

This line contains a 1 but is not a mistake
The small brown fox jumped over the lazy dog.
This line contains a 1 but is a m1stake
How are you today?
mi|k
That's fine; this isn't....
10,658
Posted By methyl
Explanation of the error. Your "tr" command...
Explanation of the error.
Your "tr" command strips out all line terminators (\n) for some unknown reason and converts them to "+" signs. My version of "sed" will not process lines without a line...
10,658
Posted By vgersh99
how about: getip test | grep -o "^[0-9.]*" | tr...
how about:
getip test | grep -o "^[0-9.]*" | tr "\n\r\f" "+" | sed 's/+$/&0/' | bc
Showing results 1 to 25 of 28

 
All times are GMT -4. The time now is 06:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy