hankknight
asked on
Linux: Process file in reverse
This returns the number 200 just as it should, because there are 200 lines in the file:
#!/bin/bash
while read MONTH DAY TIME DATA
do
COUNT=$((COUNT+1))
done < $1
echo $COUNT
When I try to do this in reverse it returns 1.
#!/bin/bash
while read MONTH DAY TIME DATA
do
COUNT=$((COUNT+1))
done <<< $(tac $1)
echo $COUNT
I am using CentOS.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER