Counting a text pattern ocurrence

suggest change

Using a pipe makes the output of a command be the input of the next one.

ls -1 | grep -c ".conf"

In this case the ouput of the ls command is used as the input of the grep command. The result will be the number of files that include “.conf” in their name.

This can be used to contruct chains of subsequent commands as long as needed:

ls -1 | grep ".conf" | grep -c .

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents