Remove all lines that don't end with specific string
-
21-12-2019 - |
Pregunta
working on a large text file and I'd like to remove all lines that don't contain the text "event":"click"}]
I've tried to do some regex within Sublime 3 and can't get it to stick.
Solución
I have not used sublime but you could select all line not containing the text "event":"click"}]
with the regex:
^(.(?!"event":"click"\}\]))*$
I think you could replace them by nothing(empty string) or backspace
Otros consejos
Use this one to get result to stdout
sed -n '/"event":"click"\}\]$/p' your_large_file
Use this one to keep only lines that end with "event":"click"}]
, your_large_file.old backup will be generated
sed -i.old -n '/"event":"click"\}\]$/p' your_large_file
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow