Skip to content

Instantly share code, notes, and snippets.

@stuntgoat
Created April 17, 2014 01:29
Show Gist options
  • Save stuntgoat/10946949 to your computer and use it in GitHub Desktop.
Save stuntgoat/10946949 to your computer and use it in GitHub Desktop.
get a single line by line number from a file with bash
function getl() {
if [ "$1" -a "$2" ]
then
tail -n+"$1" "$2" | head -n1
else
echo "Usage: getl "
fi
}
as seen on:
http://stackoverflow.com/questions/6022384/bash-tool-to-get-nth-line-from-a-file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment