×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    Awk pattern matching

    Revision as of 22:02, 11 November 2003 by imported>DrOwl
    (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

    AWK its big ... a full on ProgrammingLanguage really

    a GooD place to get more info is in the standard *nix ManCommand
    

    Examples

    to make a list of all the users and shell's that are in use on your box
     (not a verry practical example as there are non user enrtys in your passwd file but...)
    
    cat /etc/passwd | awk -F: ' {print $1 " " $7 }'
    
    Explanation
    
    -F: = use : as the separator ie use -F, for a csv file awk uses a space as standard
    print = print to StdOut
       $1 = the first varible found...
       " " = a space... well any string
       $7 = the 7th varible found
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.