Help Me with the command

Hello Friends,

Today I was trying to make a script which can take the world count of the files present in the directory.

wc -l file1
wc -l file 2 

problem is there are hundred of files & I want to take the count of each file & then subtract the header & trailer from the output
Ex:

wc -l file1

result is:

2890 file1

i need 2888 after minus 2.

I did the same thing for file size like below:

cd /abc/def/hij
$ ls -l  | awk '{ print $5}' | sort -n > /export/home/tush/file_size.csv

I don't want to do it manually so pl help me here with some command so that I can take the wc -l of each file substracting the header & trailer & redirect the desired output to my home dir.

Many thanks in advance
Tush :slight_smile:

If every file has always two records that you do not want to count,
then multiply the number of files by two and then subtract this number from the total wc.

To find the number of files:

ls -1 | wc -l