awk_for_tabulated_files
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| awk_for_tabulated_files [2021/07/06 12:37] – 156.34.16.174 | awk_for_tabulated_files [2021/07/06 12:42] (current) – 156.34.16.174 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | The command awk can be really useful to edit or parse tabulated files (for example: blast output | + | The command awk can be really useful to edit or parse tabulated files (for example: blast outputs |
| 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 " | 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 " | ||
| Line 19: | Line 19: | ||
| - | How to invert 2 columns (fields) | + | How to invert 2 columns (fields) |
| ex: Inverting the query (column 1) and the target (column 2) | ex: Inverting the query (column 1) and the target (column 2) | ||
| < | < | ||
| Line 34: | Line 34: | ||
| - | How to use the **if** statement | + | How to use the **if** statement |
| ex 1: printing a line if the name of the query (first column) contains " | ex 1: printing a line if the name of the query (first column) contains " | ||
| < | < | ||
| Line 55: | Line 55: | ||
| </ | </ | ||
| - | How to use the **if** statement with 2 conditions | + | How to use the **if** statement with 2 conditions |
| - | printing a line if the name of the query contains " | + | ex: printing a line if the name of the query contains " |
| < | < | ||
| $user awk -F " | $user awk -F " | ||
| Line 67: | Line 67: | ||
| - | printing a line if the name of the query contains " | + | ex: printing a line if the name of the query contains " |
| < | < | ||
| user$ awk -F " | user$ awk -F " | ||
| Line 81: | Line 81: | ||
| - | How to use the if and else statments | + | How to use the if and else statments |
| - | printing the first column of a line if the query (first column) contains " | + | ex: printing the first column of a line if the query (first column) contains " |
| < | < | ||
| user$ awk -F " | user$ awk -F " | ||
| Line 94: | Line 94: | ||
| </ | </ | ||
| - | How to make numeric operations on certain fields | + | How to make numeric operations on certain fields |
| ex 1: printing the column 2, the column 10 and the column 10 -100 | ex 1: printing the column 2, the column 10 and the column 10 -100 | ||
| < | < | ||
awk_for_tabulated_files.1625585874.txt.gz · Last modified: by 156.34.16.174
