/contrib/ee/genstr

https://bitbucket.org/freebsd/freebsd-head/ · Shell · 32 lines · 24 code · 7 blank · 1 comment · 2 complexity · a7f2bb72f5826cf66e4d37cc5b010db6 MD5 · raw file

  1. #!/bin/sh
  2. set -x
  3. if [ $# -lt 2 ]
  4. then
  5. echo usage $0 source_file dest_file
  6. exit 1
  7. fi
  8. trap 'rm -f /tmp/$$.out; exit 0' 0 # set up traps to clean up
  9. trap 'rm -f /tmp/$$.out; exit 1' 1 2 3 15 # on errors AND normal exit
  10. if [ -f $2 ]
  11. then
  12. rm $2
  13. fi
  14. cat $1 | grep 'catgetlocal.*\"*\"' |
  15. sed -e 's/^.*catgetlocal(//' |
  16. sed -e 's/^[ ]*//' |
  17. sed -e 's/, \"/ \"/' |
  18. sed -e 's/);//' > /tmp/$$.out
  19. cat > $2 <<EOF
  20. \$
  21. \$
  22. \$set 1
  23. \$quote "
  24. EOF
  25. sort -n < /tmp/$$.out >> $2