fix: Improve grep command to filter files ending with .txt (#7627)

pull/7636/head
Ikboljon Abdurasulov 3 weeks ago committed by GitHub
parent 0d3fdb2319
commit 7254a58328
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      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: Here is a simple example of piping two commands, `ls` and `grep`, to list all the text files in the current directory:
```bash ```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: Visit the following resources to learn more:
- [@article@Piping and Redirection](https://ryanstutorials.net/linuxtutorial/piping.php#piping) - [@article@Piping and Redirection](https://ryanstutorials.net/linuxtutorial/piping.php#piping)

Loading…
Cancel
Save