12345678910111213141516171819202122232425 |
- #!/bin/sh
- # m.cutmatrix: this script allows to cut out matrix fields
- # written by Markus Neteler 21.July 1998
- # neteler@geog.uni-hannover.de
- if [ $# -ne 3 ] ; then
- echo
- echo "This tool displays a field out of a ASCII Matrix."
- echo "USAGE: m.cutmatrix file xpos ypos"
- echo
- exit 1
- fi
- if [ ! -f "$1" ] ; then
- echo "$0: file [$1] not found"
- exit 1
- fi
- if [ $2 -lt 1 ] || [ $3 -lt 1 ] ; then
- echo "xpos ($2) and ypos ($3) must be positive integers"
- exit 1
- fi
- cat "$1" | tail -n 7 | cut -f $2 -d ' ' | head -n $3 | tail -n 1
|