selecting lines using awk

I have a file which contains five hundred thousand lines (500,000). I want to select lines of every 1000 lines from that file using AWK. I can think something like this in bash as below:

for lines in {0..500000..1000}
do
........
........
done

But I want to use AWK. I do not know how to construct in AWK and unfortunately I could not find example in online.

I appreciate if anyone could help.

Thank you.
Vijay

Try:

awk '!(NR%1000)' infile
2 Likes
awk '!(NR%1000)' file
1 Like

thru sed..

sed '1000~1000!d' inputfile > outfile # every 1000th line starting from line 1000
sed '1~1000!d' inputfile > outfile # every 1000th line starting from line 1
1 Like

Thanks so much.
It works.

Valga Valamudan