User Tools

Site Tools


awk_for_tabulated_files

This is an old revision of the document!


By default, awk scans a file line by line, whereby a line is ending by a carriage return (\n) and further split the line into fields, by default separated by a tabulation “\t” although other field separators can be defined.

The command awk can be really useful to edit or parse tabulated files (for example: blast output in columns separated by a tabulation = -outfmt 6; or gff files).

We will see how to use awk on a blast output file (-outfmt 6)

How to invert 2 columns (fields) ex: Inverting the query (column 1) and the target (column 2)



How to use the if statement ex 1: printing a line if the name of the query (first column) contains “”

ex 2: printing a line if the start of the hit in the target sequence (column X) is greater than XXX

How to use the if statement with 2 conditions printing a line if the name of the query contains “” AND if the the hit in the target sequence (column X) is greater than XXX

printing a line if the name of the query contains “” OR if the the hit in the target sequence (column X) is greater than XXX

How to use the if and else statments printing the first column of a line if the query (first column) contains “”, else print the full line

How to make numeric operations

awk_for_tabulated_files.1625582399.txt.gz · Last modified: by 156.34.16.174