I am trying to pass a file name as an argument to wc -l through xargs. Below is the command I tried:

cat > xargs wc -l

I am getting below error

cat: invalid option -- 'l'
Try 'cat --help' for more information.

Instead of redirecting stdout to xargs, use pipes:

cat | xargs wc -l

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.