40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
const fs = require('fs');
|
|
const csv = require('csv-parser');
|
|
|
|
const CSV_PATH = '/mnt/HC_Volume_103713257/tilbudgivern/frontend/firmadata/subvendor/bygma/PrisBog_CLEANED.csv';
|
|
|
|
let lineCount = 0;
|
|
let found118266 = false;
|
|
|
|
console.log('📊 Scanning CSV with csv-parser...\n');
|
|
|
|
fs.createReadStream(CSV_PATH)
|
|
.pipe(csv({
|
|
separator: ';',
|
|
headers: ['Varegrp', 'VareNr', 'Tekst', 'Enhed', 'BruttoPris', 'Opdat', 'Nettopris', 'DB-nr', 'EAN-nr', 'Std'],
|
|
skipLinesWithError: true,
|
|
strict: false,
|
|
skipEmptyLines: true
|
|
}))
|
|
.on('data', (row) => {
|
|
lineCount++;
|
|
|
|
if (row.VareNr && row.VareNr.replace(/\s+/g, '').trim() === '118266') {
|
|
found118266 = true;
|
|
console.log(`✅ FOUND 118266 at line ${lineCount}!`);
|
|
console.log('Data:', row);
|
|
}
|
|
|
|
if (lineCount % 10000 === 0) {
|
|
console.log(`Processed ${lineCount} lines...`);
|
|
}
|
|
})
|
|
.on('end', () => {
|
|
console.log(`\n📊 Total lines parsed: ${lineCount}`);
|
|
console.log(`Product 118266 found: ${found118266 ? 'YES ✅' : 'NO ❌'}`);
|
|
})
|
|
.on('error', (error) => {
|
|
console.error('❌ Error:', error.message);
|
|
console.log(`Stopped at line ${lineCount}`);
|
|
});
|