The Golden Spot

I hope this helps someone who is learning about Linux and web application programming with Python, Django, and Javascript.

Wednesday, April 16, 2014

Given a number print that line number from a file in Bash


function getl() {
    if [ "$1" -a "$2" ]
    then
        tail -n+"$1" "$2" | head -n1
    else
        echo "Usage: getl "
    fi
}

as found on: http://stackoverflow.com/questions/6022384/bash-tool-to-get-nth-line-from-a-file