This example uses sed to replace the beginning word of a sentence.
Administrator@WIN-EM8GK0ROU41 ~ $ echo "this is a line of text." | sed "s/this/This/gi;" This is a line of text. |
This is a better way to capitalize the first letter of every word in the sentence. I found this tip here.
Administrator@WIN-EM8GK0ROU41 ~ $ echo "this is a line of text." | sed -r 's/\<./\U&/g' This Is A Line Of Text. |
And here is how to only capitalize the first letter in the sentence.
Administrator@WIN-EM8GK0ROU41 ~ $ echo "this is a line of text." | sed "s/^./\u&/" This is a line of text. |
Here is a way to use sed without needing cat. I used this to nicely format a HTML file that had no newlines in it and was a mess when printed to the terminal.
jason@jason-Lenovo-H50-55:~/Downloads$ sed "s/>/>\n/gi;" index.html |
Here is a related command: this will print your gateway IP address.
jason@jason-Lenovo-H50-55:~/Downloads$ curl ipinfo.io/ip |