-4

I have a comma separated list of fonts like this:

Yeseva+one, Yrsa, ...

I need a SED expression, or similar, to turn the + into a dash and lowercase all capitals.

Update

Just wanted to say thanks for all the great help with this and if anyone needs google fonts as CSS variables / properties they are all available here (MIT License): https://github.com/superfly-css/superfly-css-variables-fonts/blob/master/src/main/css/index.css

I'll also be providing utilities for using google fonts here: https://github.com/superfly-css/superfly-css-utilities-fonts

Ole
  • 41,793
  • 59
  • 191
  • 359
  • simple enough... see https://stackoverflow.com/documentation/sed/1096/substitution/15518/pattern-flags-occurrence-replacement#t=201703290628577186994 and `The s Command` section in `info sed` – Sundeep Mar 29 '17 at 06:32
  • and why posting again? https://stackoverflow.com/questions/43085748/sed-expression-for-turning-yesevaone-into-font-yeseva-one-yeseva-one – Sundeep Mar 29 '17 at 06:34
  • Two different questions. – Ole Mar 29 '17 at 06:51

1 Answers1

2

With Bash:

a="Yeseva+One, Yrsa, Courier+New, Alegreya+Sans+SC" ; a="${a,,}";a="${a//+/-}";echo "$a"
#Output
yeseva-one, yrsa, courier-new, alegreya-sans-sc

With Sed

b="Yeseva+One, Yrsa, Courier+New, Alegreya+Sans+SC"
sed 's/.*/\L&/g; s/+/-/g' <<<"$b"
#Output
yeseva-one, yrsa, courier-new, alegreya-sans-sc
George Vasiliou
  • 6,130
  • 2
  • 20
  • 27