Quantcast
Channel: Awk for certain files in a directory - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 3 View Live

Answer by Rakesh Sharma for Awk for certain files in a directory

You can do it various ways :First change into the directory and from there run the commands + turnoff glob expansion since the $file is uncovered. cd "$dir" ;set -fstat -c '%s' $files | paste -sd+ | bc...

View Article



Answer by Freddy for Awk for certain files in a directory

You could print the files sizes in bytes using a loop with stat and sum the output with awk:for i in $files; do stat -c '%s'"$dir/$i"done | awk '{t+=$1}END{print t}'

View Article

Awk for certain files in a directory

I have a directory called 'directory1' with files: file1, file2, file3, that have been passed by in a variable 'files'. Echo $files has the following output: file1 file2 file3. I want to have the sum...

View Article
Browsing latest articles
Browse All 3 View Live


Latest Images