Skip to content

Instantly share code, notes, and snippets.

@refi64
Last active August 29, 2015 14:20
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 refi64/7c8a2a65552108c76b7c to your computer and use it in GitHub Desktop.
Save refi64/7c8a2a65552108c76b7c to your computer and use it in GitHub Desktop.
Hy line number solver
#!/bin/sh
if [ -z "$1" ] || [ -z "$2" ]; then
echo "usage: $0 <file> <line>"
exit 1
fi
line=`expr $2 - \( $2 / 256 \* 256 \) + \( $(wc -l < $1) / 256 \* 256 \)`
echo "$line: `sed ${line}q\;d $1 | sed 's/^[ \t]*//;s/[ \t]*$//'`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment