Unix/Linux Go Back    


UNIX for Beginners Questions & Answers If you're not sure where to post a Unix or Linux question, post it here. All unix and Linux beginners welcome in this forum!

Wildcards when using awk -F

UNIX for Beginners Questions & Answers


Tags
vgersh99

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 10-17-2017   -   Original Discussion by fgarvis88
fgarvis88 fgarvis88 is offline
Registered User
 
Join Date: Oct 2017
Last Activity: 17 October 2017, 9:01 AM EDT
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
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

Last edited by rbatte1; 10-17-2017 at 08:20 AM.. Reason: Added ICODE tags for clarity
Sponsored Links
    #2  
Old Unix and Linux 10-17-2017   -   Original Discussion by fgarvis88
rbatte1 rbatte1 is offline Forum Staff  
Root armed
 
Join Date: Jun 2007
Last Activity: 23 November 2017, 12:39 PM EST
Location: Lancashire, UK
Posts: 3,377
Thanks: 1,460
Thanked 665 Times in 598 Posts
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
The Following User Says Thank You to rbatte1 For This Useful Post:
fgarvis88 (10-17-2017)
Sponsored Links
    #3  
Old Unix and Linux 10-17-2017   -   Original Discussion by fgarvis88
fgarvis88 fgarvis88 is offline
Registered User
 
Join Date: Oct 2017
Last Activity: 17 October 2017, 9:01 AM EDT
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
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 :)

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

Last edited by rbatte1; 10-17-2017 at 10:11 AM.. Reason: Added ICODE tags
    #4  
Old Unix and Linux 10-17-2017   -   Original Discussion by fgarvis88
Scott's Unix or Linux Image
Scott Scott is offline Forum Staff  
Administrator
 
Join Date: Jun 2009
Last Activity: 23 November 2017, 6:43 PM EST
Location: Zürich
Posts: 8,849
Thanks: 368
Thanked 1,207 Times in 1,030 Posts
-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.
The Following User Says Thank You to Scott For This Useful Post:
fgarvis88 (10-17-2017)
Sponsored Links
    #5  
Old Unix and Linux 10-17-2017   -   Original Discussion by fgarvis88
fgarvis88 fgarvis88 is offline
Registered User
 
Join Date: Oct 2017
Last Activity: 17 October 2017, 9:01 AM EDT
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
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.

Last edited by rbatte1; 10-17-2017 at 10:12 AM.. Reason: Added ICODE tags
Sponsored Links
    #6  
Old Unix and Linux 10-17-2017   -   Original Discussion by fgarvis88
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 23 November 2017, 2:48 PM EST
Location: Aachen, Germany
Posts: 11,652
Thanks: 323
Thanked 3,620 Times in 3,325 Posts
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.
The Following User Says Thank You to RudiC For This Useful Post:
fgarvis88 (10-17-2017)
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Wildcards cokedude UNIX for Advanced & Expert Users 1 10-24-2010 05:07 AM
SED and wildcards Xterra UNIX for Dummies Questions & Answers 10 09-11-2010 05:26 PM
wildcards NOT C3000 UNIX for Dummies Questions & Answers 5 11-21-2007 07:19 AM
ls with wildcards benu302000 UNIX for Dummies Questions & Answers 10 06-29-2005 02:53 PM
wildcards benu302000 UNIX for Dummies Questions & Answers 3 06-29-2005 01:10 PM



All times are GMT -4. The time now is 07:46 PM.