I want to print all lines from a file which begin with four digits. I tried this allredy but it does not work:
cat data.txt | awk --posix '{ if ($1 ~ /^[0-9]{4}/) print $1}'
No output is generated
The next line prints all lins which start with a number:
cat data.txt | awk --posix '{ if ($1 ~ /^[0-9]/) print $1}'