I want to delete the first 25 lines of text from a .txt bots document every time when I use a command on my discord server (I know how to do that by command but I dont know how to delete the rows)
var text = fs.readFileSync("./data/bots.txt", "utf-8");
var bot = text.split("\n")
btw I cant skip them every 25 first lines because the bots file is 10.000 lines long and every time a bot is used it should be deleted from the docs
Under the assumption that each line is separated by a new line, I would:
So I'd do this with nodejs:
const fs = require("fs")
const text = fs.readFileSync("./data/bots.txt", "utf8");
const textArr = text.split("\n");
// This removes the 25th line as well, if you want to keep it
// change it to 24
const textArrNew = textArr.slice(25);
const string = textArrNew.join("\n");
fs.writeFileSync("new2.txt", string);