Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This atrocious shell script prints the first 1/nth (half, third, etc) part of a file
#get the command line arguments
#run wc on the file in argv[1]
size=`wc -l $input_file`
#split the return on whitespace - first word is now in
set $size
#get the intiger division of wc/divisor
#print the first part (wc/divisor)
head -$part $input_file

This comment has been minimized.

Copy link
Owner Author

@ivan-krukov ivan-krukov commented Aug 17, 2012

Example run:
sh file n
N is the divisor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.