Unfortunately, all other solutions that use head / tail will NOT work correctly if the line number is greater than the total number of lines in our file.
This will print the line number N or nothing if N exceeds the total number of lines:
grep "" file | grep "^20:"
If you want to cut the line number from the output, pass it through sed :
grep "" file | grep "^20:" | sed 's/^20://'
source share