cd DirA
find . -type d > /tmp/mydirs.txt
while read dir
do
cd $dir
ls *.csv | while read csv
do
awk 'FNR>10' "$csv" >> big.csv
done
mv big.csv ${dir}.csv
cd ..
done < /tmp/mydirs.txt
This just creates the csv files without whacking off the top 10 lines of the csv's.
The final large csv for the directory is in the directory.
Thanks! But the output file looks like it is just listing the names of the csv files. I have 150 subdirectories, so I would love to be able to automate it instead of doing this for each of the subdirectories.
If it prints no lines, then the files don't have more than 10 lines. You can give it -q to tell it to omit the file names.
Automate what? It's already selecting everything under folder/whatever/whatever.csv, what other folders do you want? You seemed to imply they were all at the same depth, folder/folder2/file.csv. If they're not, you need to use find and use its output to feed the tail command. xargs can turn a list of files on stdout into a list of arguments, as long as the filenames and folder names contain no spaces.