I want something I can copy/paste a log into, and it'll just remove the prompts, and then I can paste the log.
Maybe for html too.
I imagine other people would be interested in a copy paste prompt taker outer thing. Maybe they'd be willing to chip in with incentive for some genius coder?!
Would anyone like to make a copy paste prompt taker outer thing, or be willing to share one?
i'm a rebel
0
Comments
i'm a rebel
Does anyone have any ideas for cleaning up other parts of logs? Like inventory, or the line where you sent the command? Like this:
The bolded would be things I would want removed. I'd also like the line break between this and "guiding removed, too. I imagine I'd probably have to do that manually?
i'm a rebel
i'm a rebel
https://stephen.lester.io/projects/achaea/log-cleaner.html
& let me know if something's broken, and I'll try to fix it. It worked in a short example I did.
(This just takes out prompts based on the first line. Taking out inventory, qw, etc isn't that much more difficult necessarily but it's more prone to error depending.)
Any even half-decent text-editor will have regex search and replace.
If you wanted to clean out your prompt lines like this:
"5258h (100%), 3979m (85%), 100%w exEcdbkrh- 20:05:53.28 "
You would want this:
^\d+h \(\d+%\), \d+m \(\d+%\), \d+%w \w+- \d+:\d+:\d+\.\d+\s+
So it matches lines with:
^: beginning of line
\d: a number
+: one or more of the last thing (in this case one or more numbers)
h : the letter h and a space
\(: an open paren (the \ means to ignore the special thing an open paren normally in regex)
\d+: one or more numbers
%\), : a percent sign, a close paren, a comma, and a space
\d+: one or more numbers
m \(: the letter m, a space, and an open paren
\d+: one or more numbers
%\), : a percent sign, a close paren, a comma, and a space
\d+: one or more numbers
%w : a percent sign, the letter w, and a space
\w+: one or more alphanumeric characters (to match the string of letters)
- : a dash and a space
\d+: one or more numbers
:: a colon
\d+: one or more numbers
:: a colon
\d+: one or more numbers
\.: a period (again, a period means something special in regex, so we put a \ in front of it to mean "just a period, nothign special)
\d+: one or more numbers
\s+: one or more spaces
You could also be lazier if every prompt comes with a timestamp:
^.+ \d+:\d+:\d+\.\d+\s+
So it matches lines with:
^: beginning of line
.: any character
+: one or more of the last thing (in this case one or more characters)
a space
then the same stuff as above for the timestamp
That'll just grab a timestamp and all of the stuff on every line that comes before the timestamp, so you can just replace it with nothing.
Just slap a .*$ onto the end of the pattern (zero or more (*) of any characters (.) and the end of the line ($)).
If you want to be really lazy you could just throw a random symbol into the beginning of your custom prompt and delete all the lines with that symbol in it. Like put % at the beginning of your prompt then search and replace lines with:
^%.*$
Since only your prompt will ever start with %, you can safely discard every line.
Site: https://github.com/trevize-achaea/scripts/releases
Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
sed "/^[0-9]\{1,\}h/d" inputfile > outputfile
or
sed -E "/^[0-9]+h/d" inputfile > outputfile,
if your implementation supports EREs (I suspect you'd have a hard time finding one that didn't, but who knows).
Yes, but probably not in most BSDs, and by extension MacOS.