1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#!/bin/sh
# Public domain notice for all NCBI EDirect scripts is located at:
# https://www.ncbi.nlm.nih.gov/books/NBK179288/#chapter6.Public_Domain_Notice
# inspired by Steve Kinzler's align script - see http://kinzler.com/me/align/
# requires tab-delimited input, output aligned by padding with spaces
# -a Column alignment codes:
#
# l left
# c center
# r right
# n numeric (align on decimal point)
# N numeric (decimal parts zero-padded)
#
# -g Spacing between columns
# -h Indent before columns
if [ $# -gt 0 ]
then
case "$1" in
-version )
version=$( einfo -version )
echo "$version"
exit 0
;;
-help | --help | help )
version=$( einfo -version )
echo "align-columns $version"
cat << EOF
-a Column alignment letters, with last repeated as needed:
l left
c center
r right
n numeric aligned on decimal point
N numeric with decimal parts zero-padded
z zero-pad leading integers
m commas to group by 3 digits
M commas plus zero-pad decimals
-g Spacing between columns
-h Indent before columns
-w Minimum column width
EOF
exit 0
;;
* )
break
;;
esac
fi
if [ "$#" -gt 0 ] && [ "$*" = "-" ]
then
transmute -align -h 2 -g 4 -a l
else
transmute -align "$@"
fi
|