Search This Blog

Tuesday, April 29, 2008

Sed one liners

I'm using this set of sed one liners very hardly. Today I found that I hasn't added it to my blog so I cannot find it easily. (You know I use this blog as a some kind of memory extension ;) I was trying to find sed command capitalized a variable, I couldn't find it at mentioned page. Farther searching pointed to very interesting thread at Unix .com forum. The was script doing something similar in python, perl, sed and awk. I chosen perl:
echo $myvar | perl -p -e '$_ = ucfirst'
However, python looks also nice:
echo $myvar | python -c "print raw_input().capitalize()"
Awk one is also nice, but a bit more complicated (one line):
echo $myvar |awk '{(sub("^.",substr(toupper($1),1,1),$1)); print }'

Tuesday, April 15, 2008

Very useful MacOSX key shortcut

The apple+tab key combination change between apps on MacOSX, but it works for one windows per application. What if you have more than one window for app? It is quite common when you are using X11 applications or try to use more than one terminal. To change between active window of one app you can use apple+', but it seems works only for windows on one desktop. It also not work for X11 app, but for them you can use apple+left/right arrows. One more thing. In some instruction related to MacOSX apple key is called comm and alt - option.