Top "Awk" questions

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

Deleting the first two lines of a file using BASH or awk or sed or whatever

I'm trying to delete the first two lines of a file by just not printing it to another file. I'm …

bash awk sed lines
How to remove double-quotes in jq output for parsing json files in bash?

I'm using jq to parse a JSON file as shown here. However, the results for string values contain the "double-quotes" …

bash awk sed jq
Add a new column to the file

How can I add a new column to a file with awk codes? original.file F1 F2 F3 ..F10 add …

awk add
Swap two columns - awk, sed, python, perl

I've got data in a large file (280 columns wide, 7 million lines long!) and I need to swap the first two …

sed awk
How to decode URL-encoded string in shell?

I have a file with a list of user-agents which are encoded. E.g.: Mozilla%2F5.0%20%28Macintosh%3B%20U%3B%20…

bash shell awk sed urldecode
Create a dedicated folder for every zip files in a directory and extract zip files

If I choose a zip file and right click "extract here" a folder with the zip filename is created and …

linux shell sed awk unzip
replacing the `'` char using awk

I have lines with a single : and a' in them that I want to get rid of. I want to …

awk gsub
How to get second last field from a cut command

I have a set of data as input and need the second last field based on deleimiter. The lines may …

unix awk cut
Splitting a file in linux based on content

I have an email dump of around 400mb. I want to split this into .txt files, consisting of one mail …

linux file bash sed awk
How to print lines between two patterns, inclusive or exclusive (in sed, AWK or Perl)?

I have a file like the following and I would like to print the lines between two given patterns PAT1 …

shell perl awk sed pattern-matching