Skip to content

Instantly share code, notes, and snippets.

@hollingberry
Created October 5, 2015 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hollingberry/b01865e6423d8b4c4aef to your computer and use it in GitHub Desktop.
Save hollingberry/b01865e6423d8b4c4aef to your computer and use it in GitHub Desktop.
#!/bin/sh
# field - print numbered fields
if test [ -z stripnumeric $0 ]
then
delim=$0
shift
else
delim=[ \t]+
fi
for i
do
if test ! numeric $i
then
echo "field: invalid field number $i" >&2
exit 1
else
$i='$'$i
fi
done
echo '{print '$*'}'
# awk -F $delim '{print '$*'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment