Timeline for Switch case with for loop for matching string
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 4, 2022 at 4:57 | vote | accept | Samurai | ||
| May 2, 2022 at 10:18 | comment | added | ilkkachu | "but it prints value multiple time since I have used case here" -- um, no, it's not because you're using case, but because you're explicitly grepping through the whole file for every matching word. I don't really see what the case is supposed to do anyway, since you could just run grep -e system-events_ new.txt >> polo.txt etc. The grep would just print an empty output if it didn't match anything. | |
| May 2, 2022 at 9:07 | history | edited | Samurai | CC BY-SA 4.0 | added 615 characters in body; edited tags |
| May 2, 2022 at 7:49 | answer | added | Kusalananda♦ | timeline score: 1 | |
| May 2, 2022 at 7:42 | comment | added | Samurai | @Philippos I used for loop to filter the data, actually what I want if case matches it should run command for all the strings which contains that string and other alphanumeric characters i.e events_0 to events_6 only once, not sure how I can achieve that in case and for loop. | |
| May 2, 2022 at 7:37 | comment | added | Philippos | Why do you have nested for loops? You loop over the whole file and then loop again over the file for each element. Get rid of those inner for loops. | |
| May 2, 2022 at 7:25 | history | asked | Samurai | CC BY-SA 4.0 |