Wildcards when using awk -F

Trying to filter information when using awk -F . I'm trying to use wildcards to match a range of values but can't get the syntax to work.

Since I'm using awk -F I'm setting my delimiter then entering specific information abcde but if I want to do abcd(e-9) how do I make that work? Do I place the escape character in the quotes?

Any help is appreciated

Welcome fgarvis88,

I have a few to questions pose in response first:-

  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using?

Most importantly, What have you tried so far?

We're all here to learn and getting the relevant information will help us all.

Kind regards,
Robin

I have tried using abcd... , abcd...* , ^abcd , /abcd...\ , abcd/e-9\ basically just different combinations to get it to filter what I want but to no avail.

When I don't use proper syntax I either get an error message with a "^" pointing to the place where the syntax goes wrong or it just hangs up and sits there in a loop and I escape out of it to try again.

I'm fairly new to this and regex/syntax aren't my strongest suit.

Using 14.04.01 Ubuntu

---------- Post updated at 06:43 AM ---------- Previous update was at 06:33 AM ----------

Also if you want to message me I'm open to that. I can't send messages since I'm such a noob :slight_smile:

---------- Post updated at 06:47 AM ---------- Previous update was at 06:43 AM ----------

I also thought it may be easier to set a variable for what I'm looking for and stick it in there. I haven't set variables using awk before but that might be the more efficient way to go.

-F is for specifying field separators. It's not intended to match strings. That's something you would do in the awk itself. -F can be ranges (of characters), for example -F "[a-e0-9]" would identify any character a through e, and 0 through 9 in the input as a field separators. But I doubt that's what you really want to do.

What exactly are you trying to do (without trying to tell us how you're doing it, because I think that's confusing us, well me anyway!)? It would help if you gave, also, a sample of the input file you using.

Right, I'm using -F so I can filter on particular fields. This is a SecOnion VM so I'm trying to use some sort of wildcard combo to filter certain octets of an IP address of web traffic.

For instance I'm looking at http traffic but I want to see 5 or 6 fields so I can focus on who is talking to who. I want to filter out a range of IP's that take up a bulk of the traffic so I can focus on the onesies and twosies easier.

Please become accustomed to provide decent context info of your problem.

It is always helpful to carefully and detailedly phrase a request, and to support it with system info like OS and shell, related environment (variables, options), preferred tools, adequate (representative) sample input and desired output data and the logics connecting the two including your own attempts at a solution, and, if existent, system (error) messages verbatim, to avoid ambiguities and keep people from guessing.