Top "Awk" questions

AWK is an interpreted programming language designed for text processing and typically used as a data extraction and reporting tool.

How can I use ":" as an AWK field separator?

Given the following command, echo "1: " | awk '/1/ -F ":" {print $1}' why does AWK output: 1: ?

bash awk
How to do a recursive find/replace of a string with awk or sed?

How do I find and replace every occurrence of: subdomainA.example.com with subdomainB.example.com in every text file …

bash sed awk replace
How do I use shell variables in an awk script?

I found some ways to pass external shell variables to an awk script, but I'm confused about ' and ". First, …

bash shell awk
Find and kill a process in one line using bash and regex

I often need to kill a process during programming. The way I do it now is: [~]$ ps aux | grep 'python …

regex bash terminal awk
Bash tool to get nth line from a file

Is there a "canonical" way of doing that? I've been using head -n | tail -1 which does the trick, but …

bash shell unix awk sed
Using awk to print all columns from the nth to the last

This line worked until I had whitespace in the second field. svn status | grep '\!' | gawk '{print $2;}' &…

linux awk
How to split a delimited string into an array in awk?

How to split the string when it contains pipe symbols | in it. I want to split them to be in …

string unix awk split
How to print matched regex pattern using awk?

Using awk, I need to find a word in a file that matches a regex pattern. I only want to …

regex awk
Using multiple delimiters in awk

I have a file which contain following lines: /logs/tc0001/tomcat/tomcat7.1/conf/catalina.properties:app.env.server.name = demo.…

awk command-line text-processing
How to get the second column from command output?

My command's output is something like: 1540 "A B" 6 "C" 119 "D" The first column is always a number, followed by a …

shell awk ksh