Richard Owlett wrote:
I heavily use SeaMonkey's Mail/News tagging feature (currently ~50
unique tags). I extracted the appropriate lines from prefs.js and
edited it such that Gnumeric read it as CSV.
It displays it as:
label1 color #FF0000
label1 ordinal $lg
label1 tag Important
label2 color #990000
label2 ordinal $lb
label2 tag "re repository"
label3 color #99FFFF
label3 ordinal $ld
label3 tag Personal
I want it to look like:
label1 #FF0000 Important
label2 #990000 "re repository"
label3 #99FFFF Personal
I've not done anything with spreadsheets in DECADES.
{Lotus and Visicalc were only game in town}
Suggestions &/or reading assignment?
TIA
Richard Owlett
See below for "Script", "Input File", and "Output File" ... this is a
BASH script, containing some SED and GAWK lines ... someone else may be
able to do that more elegantly?
Hope that helps, or at least is a starting point
Regards
Fred James
[Script]
#! /bin/bash
Hold=""
Filename="label.table.txt"
Count=0
Sw=0
Blank=" "
while IFS= read -r line
do
howLong=`echo $line | gawk '{ print length($0) }'`
if test $howLong -ne 0
then
Count=`expr $Count + 1`
numFields=`echo $line | gawk '{ print NF }'`
First=`echo $line | gawk '{ print $1 }'`
Second=`echo $line | gawk '{ print $2 }'`
Third=`echo $line | gawk '{ print $3 }'`
if test $numFields -eq 5
then
line=`echo $line | sed 's/"//g'`
Forth=`echo $line | gawk '{ print $4 }'`
Fifth=`echo $line | gawk '{ print $5 }'`
else
Forth=`echo $line | gawk '{ print $4 }'`
fi
case $Count in
1) Label=$Second
Colour=$Forth
Sw=1
;;
3) Name=$Forth
if test $numFields -eq 5
then
Name2=$Fifth
fi
Sw=2
;;
*) ;;
esac
if test $Sw -eq 2
then
if test $numFields -eq 5
then
printf "%s %s \"%s %s\"\n" $Label
$Colour $Name $Name2
else
printf "%s %s %s\n" $Label $Colour $Name
fi
Sw=0
Count=0
fi
fi
done < $Filename
exit 0
[Input File]
> label1 color #FF0000
> label1 ordinal $lg
> label1 tag Important
> label2 color #990000
> label2 ordinal $lb
> label2 tag "re repository"
> label3 color #99FFFF
> label3 ordinal $ld
> label3 tag Personal
[Output File]
label1 #FF0000 Important
label2 #990000 "re repository"
label3 #99FFFF Personal
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug