partition

I want to keep only the lines before a certain string in a txt file

I want to keep only the lines before a certain string in a txt file Question: I want all lines before the line that has string ‘VarList’. I cannot understand why the solutions proposed elsewhere do not work for my txt file. To simplify: I have many .txt files that look like this: text1=text text2=text …

Total answers: 2