09-08-2023, 11:52 AM
Parenthesize the First Character of Each Word Using the sed Command
Here's an example of a sed command to parenthesize the first character of each word:
echo "desired_sentence" | sed 's/\(\b[A-Z]\)/\(\1\)/g'
For example, to display the first character of "An example of the sed command" in parentheses, enter:
echo "An example of the sed command" | sed 's/\(\b[A-Z]\)/\(\1\)/g'

