Timeline for How can I use quantifiers in a sed substitution expression (indenting text)?
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 15, 2021 at 17:34 | comment | added | steeldriver | Note that $(printf "%10s") really prints a space-padded empty string; an alternate that is closer to the concept of a "quantifier" might be $(printf " %.0s" $(seq 10)) which could be applied to any substring $(printf "abc%.0s" $(seq 10)), similar to perl's x 10 string repetition. | |
| Jul 15, 2021 at 16:16 | comment | added | ChennyStar | @schrodigerscatcuriosity : "I don't think it's possible since the replacement in sed substitutions isn't a regular expression". YES, it is possible, without using printf. Check my solution below (echo something | sed ':lbl; /^ \{10\}/! {s/^/ /;b lbl}') | |
| Jul 15, 2021 at 14:41 | history | edited | schrodingerscatcuriosity | CC BY-SA 4.0 | deleted 1 character in body |
| Jul 15, 2021 at 11:53 | comment | added | schrodingerscatcuriosity | @steeldriver I was jsut reading the sed manual and was wondering if that would be an option :) | |
| Jul 15, 2021 at 10:10 | vote | accept | ChennyStar | ||
| Jul 17, 2021 at 17:16 | |||||
| Jul 15, 2021 at 10:04 | history | edited | schrodingerscatcuriosity | CC BY-SA 4.0 | deleted 26 characters in body |
| Jul 15, 2021 at 9:42 | history | answered | schrodingerscatcuriosity | CC BY-SA 4.0 |