Last active
March 9, 2019 08:25
-
-
Save isomorphisms/9537586 to your computer and use it in GitHub Desktop.
an inspector/peeking function ... alternative to "head"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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