From 6030a9802d026d10c91b599d31dc9515e98ed65c Mon Sep 17 00:00:00 2001 From: "ndomassi.tando_ird.fr" <ndomassi.tando@ird.fr> Date: Tue, 26 Nov 2024 15:06:16 +0000 Subject: [PATCH] changement de position nouvel exo > et && --- docs/pages/bash/bash-extracting_from_files.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/pages/bash/bash-extracting_from_files.md b/docs/pages/bash/bash-extracting_from_files.md index 82e612f..c349008 100644 --- a/docs/pages/bash/bash-extracting_from_files.md +++ b/docs/pages/bash/bash-extracting_from_files.md @@ -186,12 +186,7 @@ You can redirect a result and store it in a file thanks to the `>` redirection: grep ";2005;" nat2021.csv > selected_names.txt ``` -!!! question "Erase the file `selected_names.txt`and reproduce the pratice by chaining commands with `&&`" -??? example "Click to show the solution" - ```bash - rm -rf selected_names.txt && grep ";2005;" nat2021.csv > selected_names.txt && grep ";2006;" nat2021.csv >> selected_names.txt && wc -l selected_names.txt && grep ";2007;" nat2021.csv >> selected_names.txt && wc -l selected_names.txt - ``` !!! question "Add all names from 2006 and 2007 into this file. Check the number of lines after each action" @@ -204,6 +199,13 @@ You can redirect a result and store it in a file thanks to the `>` redirection: wc -l selected_names.txt ``` +!!! question "Erase the file `selected_names.txt`and reproduce the pratice by chaining commands with `&&`" + +??? example "Click to show the solution" + ```bash + rm -rf selected_names.txt && grep ";2005;" nat2021.csv > selected_names.txt && grep ";2006;" nat2021.csv >> selected_names.txt && wc -l selected_names.txt && grep ";2007;" nat2021.csv >> selected_names.txt && wc -l selected_names.txt + ``` + ## Replacing patterns (sed) -- GitLab