Last active
January 1, 2016 11:48
-
-
Save isomorphisms/8140037 to your computer and use it in GitHub Desktop.
alternative peeking tool to head and tail: pick out a random 20 lines of a file, plus the first and last lines.
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
#!/bin/bash | |
# peek | |
# look at N random lines of datafile.csv | |
# usage: rand datafile.csv N | |
# rand $1 $2 | |
head -1 $1 #names row of $1 | |
if [ -z $2 ] ; then #IFNDEF | |
shuf $1 | head -20 | |
else | |
shuf $1 | head -$2 #N=$2 | |
fi | |
tail -1 $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment