#!/bin/bash # convert curfloo commands to gyach cd ~/.curfloo if [ ! -f ~/.gyach/aliases ] then echo "can't find ~/.gyach/aliases commands file" exit fi cp -av ~/.gyach/aliases ./gyachcoms sed -e 's/::/:/g' gyachcoms |\ tee newgyachcoms |\ awk 'BEGIN { FS="]" ORS="" } { if (substr($1,1,1) == "#"){ print $0"\n" } else { comname=$1 comboth=substr($0,index($0,$2)) lenboth=length(comboth) locsep=index(comboth,"|") comright=substr(comboth,locsep+1) lenright=length(comright) lenleft=lenboth-(lenright+1) comleft=substr(comboth,1,lenleft) if (lenright > 1){ print $1":"comright"\n" } else { print $1":"comleft"\n" } } }' > newcoms if [ ! -f ./commands.org ] then cp -av ./commands ./commands.org fi cat ./commands.org ./newcoms > ./commands.new