Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to list number of lines inside each file listed by the ls command?

I am using the bash ls command as follows:

ls -S -l *usc*.vhd

This lists all the files that have the letters usc in its name and ends with .vhd extension. Now, I also need the output to print how many lines there are in each file. Is this possible in bash? I will need to use wc command of bash in some way but don’t know how.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Use find with exec param instead of ls command:

find . -type f -name "*usc*.vhd" -exec wc -l {} \;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading