You're viewing a comment by Peter Passchier and its responses.

Peter Passchier Permalink
February 22, 2009, 11:23

One-liner 42 is not correct if the first line of a file is empty, because it will match the initial value of a. I came up with:
awk 'BEGIN {srand();a=rand()} a!=$0 {a=$0;print}'

(I didn't understand what the semicolon after a!=$0 does or means, so I removed it, and added a print action whenever the line isn't equal to the previous.)

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "quake3_104": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.