Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/awk -f
- BEGIN { NP = 1 # Page number
- NL = 1 # Number of non-blank lines
- PP = 0 } # Consecutive blank lines?
- # Non-blank line
- /^[^\r].*$/ { lines[NL,1] = NP
- lines[NL,2] = $0
- NL++
- PP = 0 }
- # Blank line
- /^\r*$/ { if( !PP ) NP++
- PP = 1 }
- END { srand()
- r = int( rand() * NL ) + 1
- printf( "%d: %s\n", lines[r,1], lines[r,2] ) }
Add Comment
Please, Sign In to add comment