0

This converts 'a' to 'A'.

sed 's/a/A/g' <(echo "foobar")
foobAr

This supplies the commands necessary to make each vowel upper-case:

$ cat << EOF
s/a/A/g
s/e/E/g
s/i/I/g
s/o/O/g
s/u/U/g
EOF

What I'm trying to do, is to extend the first example so as to make upper case each vowel, and using a here doc, as in the second example. Any suggestion?

Man:

sed [OPTION]... {script-only-if-no-other-script} [input-file]...

-f script-file, --file=script-file add the contents of script-file to the commands to be executed

Erwann
  • 677

2 Answers2

2

You can use - with sed -f to indicate that the script should be read from standard input:

$ cat << EOF | sed -f - <(echo foobar)
s/a/A/g
s/e/E/g
s/i/I/g
s/o/O/g
s/u/U/g
EOF
fOObAr
steeldriver
  • 81,074
0

In this case, tr is the appropriate solution:

$ echo foobar | tr [aeiou] [AEIOU]
fOObAr
RonJohn
  • 1,148