could any one suggest me that how to determine if the first field is numeric and if it is greater than another number then from that point everything else should be printed using awk.
Thanks, It is working fine from command line, but when i put it in a script it gives me this error and also, could you please let me know the last "enable" why have you used it????
sorry, but your solution doesnt work. it is printing all the lines. Anbu's solution worked fine. regarding the error, I was passing incorrect parameter. Now i have managed to solve it. Anyways, Do you mind explaining me your solution and Anbu's solution????
$ cat file
AAAAA Not printed
099 Not printed
101 Printed 1
102 Printed 2
XXX Printed 3 and last
$ xxxx=100
$ awk -v xxxx=$xxxx ' ($1 ~ "^[0-9][0-9]*$" && $1 > xxxx),0 ' file
101 Printed 1
102 Printed 2
XXX Printed 3 and last
$
When the pattern in in the form of pattern1,pattern2, action is performed on every record starting whith the record that matches the first pattern pattern1, and continuing throught and including the record that matches the second pattern pattern2.
pattern1 -> ($1 ~ "^[0-9][0-9]*$" && $1 > xxxx)
pattern2 -> 0 Is equivalent To 'End Of File' since 0 is considered as false by awk.
enable != 1 && $1 ~ "^[0-9][0-9]*$" && $1 > xxxx { enable=1}
If a valid record have not been found (enable!=1) and if the current record is valid (tests on field $1), memorize valid record found (enable=1) so from this point all records must be printed.
enable
Test if a valid record have been found (false if enable==0, true otherwise).
The default action is 'print $0'