I'm new to bash and I need to do a little script to sum all file sizes, excluding subdirectories. My first idea was to keep the columns when you do ls -l. I cannot use grep, du or other advanced commands I've seen around here.
$9 corresponds to the 9th column where the name is shown.
$5 is the size of the file.
ls -l | awk '{if(-f $9) { total +=$5 } }; END { print total }