You will understand the difference with this awk command:
awk '/^[0-9]/' file
2015
Now awk runs on a full line, such as sed, and not just in the first field.
$1 ~ /^[0-9]/compares only the first field and since the space is the default field separator in awk, therefore the first field 2015in both lines is independent of the spaces in front of it.
source
share