Skip to main content
10 events
when toggle format what by license comment
Nov 16, 2019 at 0:51 vote accept CommunityBot
Nov 11, 2019 at 14:06 comment added Ed Morton When you say print a random line from the file - do you literally mean the output has to be random or are you OK with getting the first line that matches output?
Nov 11, 2019 at 14:03 answer added Ed Morton timeline score: 0
Nov 11, 2019 at 13:57 comment added Ed Morton edit your question to include concise, testable sample input and expected output so we can best help you.
Nov 10, 2019 at 22:41 comment added steeldriver "$yearpref1" will be a literal string here (use -v to pass shell variables, or make use of the ENVIRON array), and -eq is not an awk operator, so it will be treated as arithmetic expression - 0
Nov 10, 2019 at 22:38 history edited steeldriver CC BY-SA 4.0
improved formatting
Nov 10, 2019 at 21:58 comment added Bagalaw This would be a lot easier, readable and less error-prone if you did it in Python. Are you interested in that solution or awk only? I think you can first grep for lines that match the preference, then do the random sample.
Nov 10, 2019 at 21:50 history edited Jeff Schaller
edited tags
Nov 10, 2019 at 21:15 review First posts
Nov 11, 2019 at 0:16
Nov 10, 2019 at 21:10 history asked user381358 CC BY-SA 4.0