I can't seem to find anything on these switches. I know the "-F" option can be used to change the delimiter but that's the extent of what I've found other than it looks like maybe a compiling option; I may be way off.

I know that -f is a command line option, but I can't seem to find any other info on them. As for the ~ operator, I just don't know why you use it.

closed as off-topic by Archemar, G-Man, Jesse_b, Hauke Laging, Kusalananda Apr 6 '18 at 18:02

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Archemar, Hauke Laging, Kusalananda
If this question can be reworded to fit the rules in the help center, please edit the question.

  • How else would you compare a string and a regex if not with ~? And for -f, see, for example, the GNU awk manual. – muru Apr 4 '18 at 2:13

The GNU awk manual describes the option -f as:

-f source-file or --file source-file

Read the awk program source from source-file instead of in the first nonoption argument. This option may be given multiple times; the awk program consists of the concatenation of the contents of each specified source-file.

As for the operators ~ and !~, they perform regular expression comparisons:

  1. exp ~ /regexp/ -> is true, if the expression exp (taken as a string) matches the regular expression regexp

  2. exp !~ /regexp/ -> is true, if it doesn't match

Random example:

top -b -n 1|awk '$2 !~ /root/'|awk '$1 ~ /^[0-9]+$/'|head

Not the answer you're looking for? Browse other questions tagged or ask your own question.