Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
isi-formation-unix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ISI
isi-formation-unix
Commits
6d35f773
Commit
6d35f773
authored
4 months ago
by
alexis.dereeper_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
Update bash-extracting_from_files.md
parent
830bbc65
No related branches found
No related tags found
No related merge requests found
Pipeline
#39809
passed
4 months ago
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/pages/bash/bash-extracting_from_files.md
+4
-4
4 additions, 4 deletions
docs/pages/bash/bash-extracting_from_files.md
with
4 additions
and
4 deletions
docs/pages/bash/bash-extracting_from_files.md
+
4
−
4
View file @
6d35f773
...
@@ -148,22 +148,22 @@ The `cut` command allows to cut a line at a specific character and extract a sel
...
@@ -148,22 +148,22 @@ The `cut` command allows to cut a line at a specific character and extract a sel
*
`-d`
specify the separator
*
`-d`
specify the separator
*
`-f`
specify the field to extract
*
`-f`
specify the field to extract
!!! question "Combining with
`sort`
command, how can you extract the name of the top
3
0 most popular names and the corresponding year"
!!! question "Combining with
`sort`
command, how can you extract the name of the top
5
0 most popular names and the corresponding year"
??? example "Click to show the solution"
??? example "Click to show the solution"
```
bash
```
bash
# command
# command
sort
-n
-t
';'
-k4
nat2021.csv |
tail
-n
3
0 |
cut
-d
";"
-f
2,3
sort
-n
-t
';'
-k4
nat2021.csv |
tail
-n
5
0 |
cut
-d
";"
-f
2,3
```
```
The
`uniq`
command can be used to remove the redundancy. But result need to be sorted to make it work properly/
The
`uniq`
command can be used to remove the redundancy. But result need to be sorted to make it work properly/
!!! question "
C
ould you now find a way to filter the redundancy"
!!! question "
Using
`uniq`
, c
ould you now find a way to filter the redundancy
by keeping only the names
"
??? example "Click to show the solution"
??? example "Click to show the solution"
```
bash
```
bash
# command
# command
sort
-n
-t
';'
-k4
nat2021.csv |
tail
-n
10
0 |
cut
-d
";"
-f
2 |
sort
|
uniq
sort
-n
-t
';'
-k4
nat2021.csv |
tail
-n
5
0 |
cut
-d
";"
-f
2 |
sort
|
uniq
```
```
!!! question "How many time the name JEAN has been provided in total?"
!!! question "How many time the name JEAN has been provided in total?"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment