mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-11 19:53:59 +02:00
fix: Improve grep command to filter files ending with .txt (#7627)
This commit is contained in:
committed by
GitHub
parent
0d3fdb2319
commit
7254a58328
@@ -5,10 +5,10 @@ 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:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user