Skip to content

Instantly share code, notes, and snippets.

@isomorphisms
Last active March 9, 2019 08:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isomorphisms/9537586 to your computer and use it in GitHub Desktop.
Save isomorphisms/9537586 to your computer and use it in GitHub Desktop.
an inspector/peeking function ... alternative to "head"
#print a specific line
li() { sed -n "$1"p ; }
lines() { sed -n "$1,$2"p ; }
#whitespace
ws() { echo -e "\t⋮\t⋮\t⋮" ; } #could also do this once for each column à la (head -1 | tr -dC , | sed "s/,/\t⋮/g")
#inspect / peek
i() {
local LINE_NUMBER= $(($RANDOM % `wc -l`)) #this can be worked up into something more … or less …
# ( subshell ) <file
(head -2 ; ws; li $LINE_NUMBER,$LINE_NUMBER+5 ; ws ; tail -3 )
}
#nohead
nh() {
tail -n +2 $1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment