Attached my solution using a line capable editor inside RXVT and XTerm
classic foo bar goo duu non sense written
All features are dynamically configured - on/off - term type.
EXCEPT the scroll back buffer... defined upon calling convention..
Thanks. I will try them out. I'm always willing to try different tools. Even if they don't end up being used in this case, I learn something new and it may come in handy in the future.
I actually use this method in some log records...
They are concurrently dumped to a file... some time stamped..
( $shell_logger ) 2>&1 | \
awk 'BEGIN {FS=":";} NF>1 { print $2; } NF<2 { print $0; }'| \
nl -ba -nrn -s":" > file_numbered.log
# then at any time I can edit by line the record file as shown above.
# in VI we just do
vim +linenum file_numbered.log
nothing prevents you to also have an open terminal like
said above using the numbered file in less ( raw mode)
both windows will do the trick
the record separator can purge time stamps if needed...
and VI can also do this trick inside by opening the two files
simultaneously in vertical panned mode....
Paul
I wouldn't have thought of doing this myself. I don't know the exact use case of the OP though, but as I think you suggested, I would just have redirected the log's output to a file, and then read the file with any editor that has line numbering.
My first understanding is that..
But lately I realized that may be just a flooding problem..
An awk filter is much much handy.. anything on the fly like..
(..)
($0 ~ /error/ ) { print $0; }
($0 ~ /timeout/ ) { print $0; }
(..)
Anything else is dumped in the void not console..
Paul
I would just have redirected the log's output to a file, and then read the file with any editor that has line numbering.
If I view in them in an editor, I lose all the color coding from the logcat-colorize that identifies errors, information, warnings, etc. There's no editor that I know that can color code adb logcat output.
All GTK+3 GtkSourceView-based text editors, including gedit and pluma, have logcat color highlighting. If you open the raw uncolored logcat file in Pluma/gedit, you can choose View > Highlight Mode > Other > logcat.
The highlighting is based on GtkSourceView 3.0, and is specified in /usr/share/gtksourceview-3.0/language-specs/logcat.lang:
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of GtkSourceView
Authors: Ryuinferno, Paul Lammertsma, Kelly Craft
Copyright (C) 2013 Ryuinferno <ryuinferno.xda@gmail.com>
Copyright (C) 2014 Paul Lammertsma <paul@pixplicity.com>
Copyright (C) 2017 Kelly Craft <mushroomhead52e@gmail.com>
GtkSourceView is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
GtkSourceView is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, see <http://www.gnu.org/licenses/>.
-->
<language id="logcat" name="logcat" version="2.0" _section="Other">
<metadata>
<property name="mimetypes">text/x-logcat</property>
<property name="globs">*.logcat</property>
</metadata>
<styles>
<style id="comment" name="Comment" map-to="def:comment"/>
<style id="verbose" name="Verbose" map-to="def:identifier"/>
<style id="debug" name="Debug" map-to="def:shebang"/>
<style id="info" name="Info" map-to="def:string"/>
<style id="warning" name="Warning" map-to="def:statement"/>
<style id="error" name="Error" map-to="def:number"/>
<style id="fatal" name="Fatal" map-to="def:error"/>
<style id="others" name="Others" map-to="def:comment"/>
</styles>
<definitions>
<context id="comment1" style-ref="comment">
<start>^---------</start>
<end>$</end>
</context>
<context id="comment2" style-ref="comment">
<start>^#</start>
<end>$</end>
</context>
<context id="datetime" style-ref="comment">
<start>^([0-9]{4}-[0-9]{2}|[0-9]{2})-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}</start>
<end> </end>
</context>
<context id="thread" style-ref="comment">
<start>([ ]+[0-9]+[ ]+|[0-9]{5} )</start>
<end>([0-9]{5}|[0-9]{4}|[0-9]{3}|[0-9]{2}|[0-9]{1})</end>
</context>
<context id="verbose" style-ref="verbose">
<start>( V |V\/|V\()</start>
<end>$</end>
</context>
<context id="debug" style-ref="debug">
<start>( D |D\/|D\()</start>
<end>$</end>
</context>
<context id="info" style-ref="info">
<start>( I |I\/|I\()</start>
<end>$</end>
</context>
<context id="warning" style-ref="warning">
<start>( W |W\/|W\()</start>
<end>$</end>
</context>
<context id="error" style-ref="error">
<start>( E |E\/|E\()</start>
<end>$</end>
</context>
<context id="fatal" style-ref="fatal">
<start>( F |F\/|F\()</start>
<end>$</end>
</context>
<!-- Main context -->
<context id="logcat" class="no-spell-check">
<include>
<context ref="comment1"/>
<context ref="comment2"/>
<context ref="datetime"/>
<context ref="thread"/>
<context ref="verbose"/>
<context ref="debug"/>
<context ref="info"/>
<context ref="warning"/>
<context ref="error"/>
<context ref="fatal"/>
</include>
</context>
</definitions>
</language>
You can modify (or rather, create your own custom modification, to cater for your particular needs) the lang files, and they'll be available the next time you start gedit/Pluma. The documentation is here (https://developer.gnome.org/gtksourceview/stable/lang-reference.html).
The downside of using gedit/Pluma is that you need to keep clicking the Reload button when it shows the file has grown, if you open it while it is being generated. Pluma at least does have line numbers (Edit > Preferences, View tab, Line numbers).
The color schemes are defined in separate Theme files, basic set installed in /usr/share/gtksourceview-3.0/styles/. Copy the nearest equivalent to your desktop, rename and edit (including the <style-scheme id="id" _name="visiblename" version="1.0"> ), and copy to ~/.config/pluma/styles/, and you can select it the next time you start Pluma, by selecting Edit > Preferences, Font & Colours tab.
(So, it's a good idea to realize the lang file specifies the context of each fragment, and the theme file the foreground and/or background color for each context.)