Counting a text pattern ocurrencesuggest 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 .
Found a mistake? Have a question or improvement idea? Let me know.
Table Of Contents