Timeline for sed code understanding for text processing
Current License: CC BY-SA 3.0
21 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 7, 2017 at 21:25 | comment | added | Philippos | Just post your questions as new questions here, give examples with expected output and you attempt. There are lots of helpful people here's someone can always help you, maybe me. Bless you. | |
| Jun 7, 2017 at 14:35 | comment | added | Sid | My bad i had a bad input file so it wasn't working, both of the codes works just fine. Is there a way to connect to you? | |
| Jun 7, 2017 at 11:31 | comment | added | Philippos | (Oops! I accidentally posted this as answer. I'm not yet used to using the iPhone app.) Strange. By using s/\n/\t/gp all should be replaced. And here it worked. Then try y/\n/\t/;p instead. | |
| Jun 7, 2017 at 9:46 | vote | accept | Sid | ||
| Jun 7, 2017 at 9:01 | comment | added | Sid | I did this, sed -n ' /Policy Name:/! d s/.*:\s\+// h :1 n /Active:\s*no/d /Policy Type:/{s/.*:\s*//;H;} /HW\//!b1 :2 s/.*\s\(\S*\)\s*/\1/ G s/\n/\t/gp n /^\s*$\|Include:/! b2 ' | |
| Jun 7, 2017 at 8:39 | comment | added | Sid | Small issue is it gives it in new line, how do I replace new line with a tab? | |
| Jun 7, 2017 at 5:34 | comment | added | Philippos | @Sid For the AIX version, the line should read /Policy Type:/{s/.*:$s*//;H;} | |
| Jun 7, 2017 at 5:29 | comment | added | Philippos | Okay, I'm back and now I understood what you want to do with the policy type. Your example didn't work for me at all, as they don't contain the HW/ mark that is needed to enter the second loop. If I change HW to LC the script runs. I edited my answer to add the policy type as a third column. | |
| Jun 7, 2017 at 5:24 | history | edited | Philippos | CC BY-SA 3.0 | Adding the policy type |
| Jun 6, 2017 at 8:59 | comment | added | Sid | Did you get a chance, also if you could modify AIX code also please. would appreciate. | |
| Jun 5, 2017 at 10:53 | comment | added | Sid | Sure no problem | |
| Jun 5, 2017 at 10:40 | vote | accept | Sid | ||
| Jun 7, 2017 at 9:46 | |||||
| Jun 5, 2017 at 10:38 | comment | added | Philippos | Sorry, very busy past days, trying later this day | |
| Jun 5, 2017 at 10:37 | comment | added | Sid | Anyone anything, i tried couple of more things still doesn't work | |
| Jun 4, 2017 at 7:08 | comment | added | Sid | Any suggestions, anyone? | |
| Jun 2, 2017 at 15:40 | comment | added | Sid | added it in my question. | |
| Jun 2, 2017 at 11:58 | comment | added | Philippos | Then I misunderstood what you tried. Please add the relevant part of the input file to your question. | |
| Jun 2, 2017 at 11:54 | comment | added | Sid | Great explanation @Philippos, However /Policy [TN][ya][pm]e:/! d didn't work, previous output use to give me like below. HW Policy Name I wanted new code to give me HW Policy Name Policy Type | |
| Jun 1, 2017 at 15:51 | history | edited | Philippos | CC BY-SA 3.0 | Work for Name or Type |
| Jun 1, 2017 at 15:43 | history | edited | Philippos | CC BY-SA 3.0 | added 540 characters in body |
| Jun 1, 2017 at 14:51 | history | answered | Philippos | CC BY-SA 3.0 |