We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
I want to count all the lines that begin with a valid date. This code works if a line begins with a valid date but if it does not then it returns an error.
#!/bin/bash NOW=$( date +"%s" ) while read MONTH DAY TIME DATA do THEN=$( date -d "$MONTH $DAY $TIME" +"%s" ) COUNT=$((COUNT+1)) done < $1 echo $COUNT
Add your voice to the tech community where 5M+ people just like you are talking about what matters.