These machines have no common sense; they have not yet learned to 'think,' and they do exactly as they are told, no more and no less. This fact is the hardest concept to grasp when one first tries to use a computer.
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.)
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
Education Sponsors
I am being sponsored by A-Writer! If you ever need help with essay writing, look no further than A-Writer! They will help you with your writing in as quickly as 3 hours!
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