I have the code:
for file in *
do
list="$list""$file "`cat $file | wc -l | sort -k1`$'\n'
done
echo $list
This outputs a list like fileA 10 fileB 20 fileC 30
.
I thought it should output:
fileA 10
fileB 20
fileC 30
I need the output to follow the latter as I then want to cycle through the $list
variable one line at a time and perform operations.
Could someone please help me out here?
Thank you.