From 7254a5832882d70056aec135afccf79da7e224db Mon Sep 17 00:00:00 2001 From: Ikboljon Abdurasulov Date: Wed, 30 Oct 2024 09:17:05 +0100 Subject: [PATCH] fix: Improve grep command to filter files ending with .txt (#7627) --- .../roadmaps/linux/content/104-text-processing/109-pipe.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/roadmaps/linux/content/104-text-processing/109-pipe.md b/src/data/roadmaps/linux/content/104-text-processing/109-pipe.md index c4311d7eb..4835c656c 100644 --- a/src/data/roadmaps/linux/content/104-text-processing/109-pipe.md +++ b/src/data/roadmaps/linux/content/104-text-processing/109-pipe.md @@ -5,11 +5,11 @@ The pipe (`|`) is a powerful feature in Linux used to connect two or more comman Here is a simple example of piping two commands, `ls` and `grep`, to list all the text files in the current directory: ```bash -ls | grep .txt +ls | grep '\.txt$' ``` -In this example, `ls` lists the files in the current directory and `grep .txt` filters out any files that don't end with `.txt`. The pipe command, `|`, takes the output from `ls` and uses it as the input to `grep .txt`. The output of the entire command is the list of text files in the current directory. +In this example, `ls` lists the files in the current directory and `grep '\.txt$'` filters out any files that don't end with `.txt`. The pipe command, `|`, takes the output from `ls` and uses it as the input to `grep '\.txt$'`. The output of the entire command is the list of text files in the current directory. Visit the following resources to learn more: -- [@article@Piping and Redirection](https://ryanstutorials.net/linuxtutorial/piping.php#piping) \ No newline at end of file +- [@article@Piping and Redirection](https://ryanstutorials.net/linuxtutorial/piping.php#piping)