i have a 15000 lines log and i want to remove a part of every line
This a what my log looks like
15 {"level":"warn","message":"warn: Player: 819631980014075905 | Track has been started playing [\u001b[34m34mSomethingElse2\u001b[39m]"}
12 {"level":"warn","message":"warn: Player: 819631980014075905 | Track has been started playing [\u001b[34m34mSomething2\u001b[39m]"}
1 {"level":"warn","message":"warn: Player: 819631980014075905 | Track has been started playing [\u001b[34m34mSomethingElse\u001b[39m]"}
3 {"level":"warn","message":"warn: Player: 819631980014075905 | Track has been started playing [\u001b[34mSomething\u001b[39m]"}
What i want the log to look like
15 SomethingElse2
12 Something2
1 SomethingElse
3 Something
Thank you all.
CodePudding user response:
I didn't completely think about just using the find/replace function of almost any text editor
CodePudding user response:
The obvious candidate is of course sed
. It depends a bit on what you used to display the input-lines (especially the \u001b
might give some trouble), but
sed 's/\{.*34m34m//;s/.u001b.*//`
You may want to put it through the same filter that you used to display the lines.