Count the pipes "|" in line and delete line if count greter then number.

Hello,
I have been working on Awk/sed one liner which counts the number of occurrences of '|' in pipe separated lines of file and delete the line from files if count exceeds "17".
i.e need to get records having exact 17 pipe separated fields(no more or less)

currently i have below :

awk -F'|' 'NF!=17 {getline;print $0;}'  < leaseLog.lst > leaseLog_clean.lst

it will generate the files leaseLog_clean.lst with records having only 17 Pipes but its also containing record having 17+ pipes in line.

Could you please suggest me where i am missing?

Thanks Ketan R

file record example:

INVALID RECORDS:
0a752000ff3fe00001207355836163|0a7537ca012073558b6163|107.17.55.002|1462686144822|50|28800|1462786596822|1462786934822|878441083|false|1461786144822|1462786140822|0|0|true|2073558b6162|ATAMAW|01042000008402062473558b616209090010118b0401090300
0a752000ff3fe00001207355836163|0a7537ca012073558b6163|107.17.55.002|1462686144822|50|28800|1462786596822|1462786934822|878441083|false|1461786144822|1462786140822
VALID RECORD:
0a1e2000ffffe00001001dd5031b23|0a1e3990010015d6031593|340.30.77.424|1462784144821|50|28800|1462783594821|1462783931821|3344733642|false|1462782344821|1462566144821|0|0|true|001dd6087b92|ATERWF|01042000009002020015d6031b920909000011834401890300

There's not a single line in your file having 17 fields:

awk -F'|' '{print NF}'  file
1
18
12
1
18

To print the lines with exactly 17 fields, try

awk -F'|' 'NF==17'  file