Timeline for Intersection of two arrays in BASH
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Nov 9, 2022 at 16:30 | history | suggested | Dmitry Shevkoplyas | CC BY-SA 4.0 |
Fixing all the examples to work. Also there were errors for cases when OP stores result "as a set" into bash variable - he was saving result as 1 large string with elements instead of proper bash array with separate elements for each item. Also src code of "uniq" does not use XOR : )
|
| Oct 27, 2022 at 21:23 | review | Suggested edits | |||
| S Nov 9, 2022 at 16:30 | |||||
| Oct 27, 2022 at 19:03 | comment | added | Dmitry Shevkoplyas | Very very nice! | |
| Sep 9, 2021 at 11:20 | comment | added | Matt Alexander |
By the way, this is a really slick solution, using uniq -d.
|
|
| Sep 9, 2021 at 10:54 | comment | added | Matt Alexander |
If you have spaces in the names, you'll be in trouble doing echo ${A[@]} | sed 's/ /\n/g' | sort | uniq. Better to do IFS=$'\n'; printf %s "${A[@]}" | sort | uniq.
|
|
| Jul 1, 2016 at 8:43 | history | answered | kenichi | CC BY-SA 3.0 |