Hello, I have a very big list of words from which I need to slice off a few entries from the bottom or top.
Currently I have this and its been working for me for a long time but recently I have been using a bigger file of around 300k lines and this is no longer working for me (it takes like 10minutes+ to complete and i've never actually seen it finish so who knows how long it will take).
Read file (reading the initial file) -> output : strTobeReplaced
Variable set (Creating an array with X amount of entries sliced off)
Variable : slicedList / value : slice(split(strToBeReplaced, "\n"), X)
*Where X is the number of entries that I want to remove from the list.
Variable set (Creating the string that will be written in file)
Variable : fileString / value : null
For each in slicedList with "i" as entry index DO ->
Variable set
Variable : fileString -> value : fileString ++ slciedList[i] ++ "\n"
Once the loop is completed there is a final Write file block
content : fileString -> the file that I want to replace
the format of said file is as shown below(where 1 line is 1 word) ex:
Adam
Jim
Robert
Is there a more optimized way of slicing off lines from a file than this?