[chirp_devel] Gnome nautilus script to clean portmon logs.
Pavel Milanes (CO7WT)
Fri May 20 11:10:40 PDT 2016
Hi to all,
Today I want to share one of y tools to make the process of debugging
portmon logs more faster and eye refreshing, this nautilus script is
intended for the users that has a GNU/Linux with any of the Gnome
flavors as a develop environment. (works with the default Ubuntu's Unity)
The goal is to clean the original portmon serial logs from all the non
essential "garbage" to make it more easy to analyze, but remember that
under certain circumstances you will have to look at the original log,
so this tool will preserver it.
To make it work you must surf into the folder
~/.local/share/nautilus/scripts/ and copy it inside; It's as easy as
follow this instructions:
* Press Alt+F2 and paste "~/.local/share/nautilus/scripts/" in the box
+ Enter, a nautilus window will open,
o If it complains about the folder not existing or do nothing,
please do this extra steps:
o Press Alt+F2 and paste "~/.local/share/nautilus/", A nautilus
window will open
o Create a folder named "scripts" (without quotes) and open it,
now follow the next step
* Just paste the file there,
* Right-click the file and select properties, then permissions
* Tick the box about allowing to run it as a program
* Close the nautilus windows, that's all.
After that you will need to find a portmon serial log and right-click
it, search for and option named "Scripts" and after expanding it you
will find the "Chirp portmon clean log" option, select it and a file
with the exact name and an extension of .clean will appear on your
folder, additionally the Gedit text editor will pop up with the clean
log on it.
Compare the original and cleaned log and your will find that your
eyes/brain will thanks you for this. This also works with several files
at once; as always use it, share it, improve it, it's GNU GPL 3.0
[The long name is because I have a lot of scripts in my script folder
and I group them by the main related activity, of course you can change
the name of it once it's recognized by the system]
73
--
73 Pavel CO7WT.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20160520/3c56948b/attachment-0001.html
-------------- next part --------------
#!/bin/bash
#########################################################
# #
# This script is to clean the portmon serial logs #
# from the non important stuff; it will preserve #
# the original log and will open it with you prefered #
# text editor (you must set it up on EDITOR) #
# #
# Licensed under the GNU GENERAL PUBLIC LICENSE 3 #
# #
# Copyright 2016 Pavel Milanes CO7WT pavelmc at gmail.com #
# #
#########################################################
# =======================================================
# some vars I always forgot, just for reference
# $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
# $NAUTILUS_SCRIPT_SELECTED_URIS
# examples of how to handle some usefull things
#FILE="/tmp/some_stuff.txt"
#DIR=`dirname "$FILE"` # /tmp/
#BASE=${FILE%.*} # /tmp/some_stuff
#EXT=${FILE##*.} # txt
# =======================================================
# Please set it up for other editor if you like it
EDITOR=`which gedit`
echo "$NAUTILUS_SCRIPT_SELECTED_URIS" > /tmp/clean_temp
for file in $(cat /tmp/clean_temp); do \
file_name=$(echo $file | sed -e 's/file:\/\///g' -e 's/\%20/\ /g')
short_file_name=$(echo $file | sed -e 's#.*/##g' -e 's/\%20/\ /g')
base=${file_name%.*}
final="$base.clean"
cat "$file_name" | sed s/"\r"//g | sed s/"\t\t"//g | grep -v "_MASK" \
| grep -v "_COMMSTATUS" | grep -v "_GET_PROPERTIES" \
| sed s/" \t"//g > "$final"
$EDITOR "$final" &
done
rm /tmp/clean_temp
exit
More information about the chirp_devel
mailing list