1. Total number of lines read.
2. Total number of different users (owners).
3. Total number of files with execute permission for the owner.
4. The top 3 largest directory.
I just need some hints.
here is my code for 1.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/bin/bash
Read line
while(line)
do
echo -n "$line"
count=$((count+1))
sed
done
echo "Total lines read: $((count-1))"
if you didn't realise it yet, this is a c++ forum. You may have better responses if you use another website.
> exemplary usage of sed
but you don't use `sed' in your snip.
> 1. Total number of lines read.
wc
> 2. Total number of different users (owners).
cut
sort
uniq
wc
> 3. Total number of files with execute permission for the owner.
perhaps you may use `find . -maxdepth 1 -executable'
you can also use `cut --characters=4' and then grep for 'x'
> 4. The top 3 largest directory.
`ls' does not provide the size of directories, you may use `du' for that