1// Import the fs module 2const fs = require('node:fs'); 3 4// Define the input and output file paths 5const inputFile = 'spooky-formatted-frequency-3.txt'; 6const outputFile = 'spooky-alt-frequency.txt'; 7 8// Define the condition to filter the lines 9const condition = 'ALT \r'; 10 11// Read the input file asynchronously 12fs.readFile(inputFile, 'utf8', (err, data) => { 13 // Handle any errors 14 if (err) { 15 console.error(err); 16 return; 17 } 18 // Split the data into an array of lines 19 const lines = data.split('\n'); 20 // console.log(lines); 21 // Filter the lines that end with the condition 22 const filteredLines = lines.filter(line => line.endsWith(condition)); 23 console.log(filteredLines); 24 // Join the filtered lines into a string 25 const outputData = filteredLines.join('\n'); 26 // Write the output data to the output file asynchronously 27 fs.writeFile(outputFile, outputData, err => { 28 // Handle any errors 29 if (err) { 30 console.error(err); 31 return; 32 } 33 // Log a success message 34 console.log('Output file written successfully'); 35 }); 36});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.