0

I have written this code (this code in bash counts the lines in all the folders), the problem is that it also writes the name of each folder. What should I do in order to make it write only the total number of the lines without the folder name?

#!/bin/bash
find $1 -type f  | xargs wc -l | cut -d "." -f1 | tac | head -n 1 | cut -d "t" -f1
Mat
  • 202,337
  • 40
  • 393
  • 406
Michelle
  • 41
  • 5
  • If you just want the total, `find "$1" -type f -exec cat {} + | wc -l` – tripleee Dec 11 '17 at 08:49
  • Does it count the total of all the lines of different files in a folder and its sub-folders? – Michelle Dec 11 '17 at 08:57
  • It cats all the files it finds and runs a word count on the concatenation. So the result is the number of lines in the files in this directory tree all strung together one after the other. It's still not clear if that's what you actually want. – tripleee Dec 11 '17 at 09:03

0 Answers0