Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please explain what does following command mean:

awk -F: '{print $4}'
share|improve this question
up vote 30 down vote accepted
awk -F: '{print $4}'
  • awk - this is the interpreter for the AWK Programming Language. The AWK language is useful for manipulation of data files, text retrieval and processing
  • -F <value> - tells awk what field separator to use. In your case, -F: means that the separator is : (colon).
  • '{print $4}' means print the fourth field (the fields being separated by :).


Let's say that there's a file called test, and it contains the following:


If we execute the command awk -F: '{print $4}' test, the output will be:


Because is is the fourth field.

      field1   field3  field5
       -----    ----    ----
       |   |    |  |    |  |
             ||      ||
             --      --
           field2  field4

share|improve this answer
No, your name is not Alaa! – Braiam Sep 15 '13 at 1:11
  • You set the field separator with ...


    so that is ":" in this example.

  • You print the text that is between the 3th and 4th separator with ...

    '{print $4}'
  • And this explains it better:

    echo "154:266:377:454:533" | awk -F: '{print $4}'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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