1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-01-16 21:58:30 +01:00

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

This commit is contained in:
Ikboljon Abdurasulov 2024-10-30 09:17:05 +01:00 committed by GitHub
parent 0d3fdb2319
commit 7254a58328
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
- [@article@Piping and Redirection](https://ryanstutorials.net/linuxtutorial/piping.php#piping)