Skip to content
Snippets Groups Projects
Commit f6d861a6 authored by jacques.dainat_ird.fr's avatar jacques.dainat_ird.fr
Browse files

cleanify question

parent 79a7fdbc
No related branches found
No related tags found
No related merge requests found
Pipeline #84574 passed
...@@ -121,7 +121,7 @@ awk -v var="$my_var" '$2 == var { print $0 }' file.txt ...@@ -121,7 +121,7 @@ awk -v var="$my_var" '$2 == var { print $0 }' file.txt
awk -F ';' 'NR > 1 {print $0}' nat2021.csv | head awk -F ';' 'NR > 1 {print $0}' nat2021.csv | head
``` ```
!!! question "Print second column of the file? In a second time try to remove redundancy (using `cut`, `sort` and `uniq`). In a third time count number of lines." !!! question "Print second column of the file? In a second time try to remove redundancy (using `sort` and `uniq`). In a third time count number of lines."
??? example "Click to show the solution" ??? example "Click to show the solution"
...@@ -131,12 +131,12 @@ awk -v var="$my_var" '$2 == var { print $0 }' file.txt ...@@ -131,12 +131,12 @@ awk -v var="$my_var" '$2 == var { print $0 }' file.txt
??? example "Click to show the solution without redundancy" ??? example "Click to show the solution without redundancy"
```bash ```bash
awk -F ';' '{print $2}' nat2021.csv | cut -d ';' -f 2 | sort -u awk -F ';' '{print $2}' nat2021.csv | sort -u
``` ```
??? example "Click to show the solution without redundancy and with count" ??? example "Click to show the solution without redundancy and with count"
```bash ```bash
awk -F ';' '{print $2}' nat2021.csv | cut -d ';' -f 2 | sort -u | wc -l awk -F ';' '{print $2}' nat2021.csv | sort -u | wc -l
# 36172 - this is the diversity of names in our file # 36172 - this is the diversity of names in our file
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment