Open rawiriblundell opened 2 years ago
It may be useful to add a function that slurps up a stream or file and returns an array e.g.
grep needle haystack | cut -d ';' -f1 | array_uniq -> slurps up stdin and puts each line into an array in the global namespace e.g. ${UNIQ[@]}
grep needle haystack | cut -d ';' -f1 | array_uniq
${UNIQ[@]}
Possibly do this either sorted or unsorted, offer functions for both, or a flag to switch desired behaviour
Standard legendary awk solution: awk '!s[$0]++'
awk
awk '!s[$0]++'
Thought:
toarray -u -> unique elements unsorted toarray -s -> sorted toarray -su -> sorted and unique
It may be useful to add a function that slurps up a stream or file and returns an array e.g.
grep needle haystack | cut -d ';' -f1 | array_uniq
-> slurps up stdin and puts each line into an array in the global namespace e.g.${UNIQ[@]}
Possibly do this either sorted or unsorted, offer functions for both, or a flag to switch desired behaviour