Get the mappings from tex file for vim plugins

2010-04-12 1 min read Linux

Get the mappings from tex file for the vim plugins.

#!/bin/bash –
#===============================================================================

#          FILE:  get_mappings_from_tex_for_vim.sh

#         USAGE:  ./get_mappings_from_tex_for_vim.sh

#   DESCRIPTION:  Get the mappings from tex file

#       OPTIONS:  —
#  REQUIREMENTS:  —
#          BUGS:  —
#         NOTES:  —
#        AUTHOR:  Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in
#       COMPANY:  Individual
#       VERSION:  1.0
#       CREATED:  09/06/2009 09:19:19 PM IST
#      REVISION:  —
#===============================================================================

set -o nounset                              # Treat unset variables as an error

file=$1
IFS=$(echo -e ’\n’)
for i in $(cat $file |grep ”^..line”)
do
#echo $i |awk -F”’” '{print $2” ” $3” ”$4}’|awk -F”&” '{print $1” ”$2}’
echo $i |awk -F”’” '{
if ( NF >= 4 )
{
print ($2”\t ->”$4”\t==»”$NF);
}
else
{
print($2”\t–>”$3);
}
fi
}’  |sed ’s/\h.*(/(/’ |sed ’s/>.*&/>/’ |sed ’s/\t*-.>$//’ |sed ’s/\//’

done

comments powered by Disqus