Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parenthesize the First Character of Each Word Using the sed Command
#1

    Parenthesize the First Character of Each Word Using the sed Command
   

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'
   

   
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)