From 5c0582c0938273bf2d14ea0cec2aaba46e057536 Mon Sep 17 00:00:00 2001 From: "alexis.dereeper_ird.fr" <alexis.dereeper@ird.fr> Date: Sat, 23 Nov 2024 09:18:45 +0000 Subject: [PATCH] Update bash-extracting_from_files.md --- docs/pages/bash/bash-extracting_from_files.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/pages/bash/bash-extracting_from_files.md b/docs/pages/bash/bash-extracting_from_files.md index 84335c6..820ecaf 100644 --- a/docs/pages/bash/bash-extracting_from_files.md +++ b/docs/pages/bash/bash-extracting_from_files.md @@ -191,7 +191,20 @@ You can redirect a result and store it in a file thanks to the `>` redirection: ## Replacing patterns (sed) +!!! question "Using the sed command, convert CSV file into a tabular file in a new file called `nat2021.tsv`" +??? example "Click to show the solution" + ```bash + # command + sed "s/;/\t/g" nat2021.csv > nat2021.tsv + ``` +!!! question "In the tabular file, replace the information 1/2 by F/M" +??? example "Click to show the solution" + ```bash + # command + sed -i "s/^1/M/g" nat2021.tsv + sed -i "s/^2/F/g" nat2021.tsv + ``` \ No newline at end of file -- GitLab