A "sed" Question...
I'm taking a Linux class, and we're all now wrestling with the "sed" editor. One of the substitution commands we were given contains this:
sed 's/^\(.\)/\U\1' > name So far, I understand everything up to the part in bold red. What does the "\U" part mean? ...Also, this doesn't pertain to a test or homework question. It's just something we were shown in class, and I still don't understand it. |
you should also learn to read the man page. type man sed, or info sed , \U is documented.
|
Try this:
Code:
echo gooFy | sed 's/^\(.\)/\U\1/' Code:
echo GooFy | sed 's/^\(.\)/\L\1/' |
Quote:
info-pages and their navigation suck, and the man page doesn't have that info ;} Cheers, Tink |
This does not appear to be documented at the SED oracle: http://www.grymoire.com/Unix/Sed.html
Where has someone actually seen it? |
Quote:
Code:
Finally, as a GNU sed extension, you can include a special sequence |
Most Linux documentation is pretty poor. On CentOS, man sed doesn't list \U.
However, googling sed "\U" gets it on the third hit. (Note that the \U was in quotes). Quote:
|
A much more cumbersome way of doing it would be:
Quote:
|
Quote:
extract of info sed Code:
... |
Thanks
Okay, that makes sense -- thanks, everybody. I understand it now. It's basically substituting the first letter for its capitalized version, and then storing the word in a register.
It's all just a bit awkward for me at this point. |
All times are GMT -5. The time now is 07:21 PM. |