How would you grep for a line containing only 5 numbers? Something like this.
10 2 12 1 13
How would you grep for a line containing only 5 numbers? Something like this.
10 2 12 1 13
Hi Cokedude,
Question was not clear.
Could explain more precisely....
---------- Post updated at 06:54 AM ---------- Previous update was at 06:49 AM ----------
Try this
grep "10 2 12 1 13" filename
awk 'NF==5 {for (i=1;i<=NF;i++) if ($i !~ /^[0-9]*$/) x=1; if (!x) print; x=""}' file
Perhaps a bit more generic:
grep "[[:space:]]*10"[[:space:]]*2"[[:space:]]*12"[[:space:]]*1"[[:space:]]*13" file4
10 2 12 1 13
echo " 10 2 12 1 13" | grep "^[ \t]*\d\+[ \t]*\d\+[ \t]*\d\+[ \t]*\d\+[ \t]*\d\+[ \t]*$"