Skip to content
Snippets Groups Projects
Commit 85787f42 authored by alexis.dereeper_ird.fr's avatar alexis.dereeper_ird.fr
Browse files

Update bash-extracting_from_files.md

parent 6d35f773
No related branches found
No related tags found
No related merge requests found
Pipeline #39812 passed
...@@ -166,11 +166,6 @@ The `uniq` command can be used to remove the redundancy. But result need to be s ...@@ -166,11 +166,6 @@ The `uniq` command can be used to remove the redundancy. But result need to be s
sort -n -t ';' -k4 nat2021.csv | tail -n 50 | cut -d";" -f 2 | sort | uniq sort -n -t ';' -k4 nat2021.csv | tail -n 50 | cut -d";" -f 2 | sort | uniq
``` ```
!!! question "How many time the name JEAN has been provided in total?"
??? example "Click to show the solution"
It start to be too complicated for the command you have seen so far, you need to use a command specific to column data `awk`
## Redirecting an output (>) ## Redirecting an output (>)
...@@ -206,4 +201,12 @@ You can redirect a result and store it in a file thanks to the `>` redirection: ...@@ -206,4 +201,12 @@ You can redirect a result and store it in a file thanks to the `>` redirection:
``` ```
## Filtering a file (awk) ## Filtering a file (awk)
\ No newline at end of file
!!! question "Using `awk` on tabular file, display the most popular names (given more than 10000 times) between 1980 and 1990"
??? example "Click to show the solution"
```bash
awk {'if ($3 >= 1980 && $3 <= 1990 && $4 > 10000)print $1'} nat2021.tsv
```
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