Search code examples
unixgrepcommandwc

What is the difference between commands "wc `grep -l int *`" and "grep -l int * | wc"?


What is the difference between these two commands:

wc `grep -l int *`
grep -l int * | wc

How does the output differ?


Solution

  • wc `grep -l int *`
    

    This will give you count of words/lines/characters for each file containing string "int".

    grep -l int * | wc`
    

    This will give you count of words/lines/characters of the output generated by grep -l int *