grep "Processing some-problem-query.xqy" ErrorLog.txt | sed "s/^.*.xqy: //g" | sort | uniq
Thursday 21 June 2012
Bash: example using grep and sed to process a MarkLogic ErrorLog.txt file
Here's an exammple of how grep, sed, sort and uniq can be used to debug entries in a log file (in this case, I'm debugging a problem with a CPF pipeline in MarkLogic).
In essence, this process filters all the lines pertaining to a CPF processing action, removes the first part of the line to remove timestamps and unnecessary information (leaving just a document URI), sorts them into an order then returns just the unique document URIs:
Monday 18 June 2012
Cygwin: Output text content to the clipboard
Sometimes it's useful to redirect the output directly to the windows clipboard so you can use the content elsewhere later (a text editor, for example):
bash-4.1$ grep "Starting MarkLogic" ErrorLog_2.txt -A50 -B260 > /dev/clipboard
Subscribe to:
Posts (Atom)