sed tutorial and help
A very nice turorial and help <a href="http://sed.sourceforge.net/grabbag/tutorials/">here.
A very nice turorial and help <a href="http://sed.sourceforge.net/grabbag/tutorials/">here.
I was actually looking for this for quite sometime. Some years back in my bashrc was the proper setting for setting the terminal title when I did a cd, and I had completely forgotten how to do it. So today I searched quite a few commands the environment variables for doing the same and found it again.
Here it is (Just put this in your bashrc or bash_profile):
export PROMPT_COMMAND=’echo -ne ”\033]0;`pwd`”; echo -ne ”\007”’
Continue reading
Today I had a hard time, I had a herculian task of converting the case of file to upper case. Well that’s not difficult :), I know. What made it difficult was the fact that not the whole file had to be converted but only selective lines containing the work important. Okay now that too is not so difficult, I thought. But again the file size was huge, it had some 9 million lines. So, I just thought of trying my skills of shell programming (dont have much of it anyway). So here’s what I did:
Continue readingmost simple solution is to alias :q like so:
alias :q=`echo ”This is not vim”`
but as someone suggested in commandlinefu, you can use tput to put some color and fun into this.
alias :q=’tput setaf 1; echo >&2 ”this is NOT vi(m) :/”; tput sgr0’
Taken idea from commandlinefu.com
The command will display a segment from the file from the start pattern to the end pattern.
function viewsegment() { tail -n +`fgrep -n -m 1 “$1” $3 | head -`fgrep -n -m 1 “$2” $3 }
Display a block of text with delineated by a start pattern and an end pattern
This function displays the latest comic from xkcd.com. One of the best things about xkcd is the title text when you hover over the comic, so this function also displays that after you close the comic.
$ xkcd(){ local f=$(curl -s <a href="http://xkcd.com/">http://xkcd.com/);display $(echo "$f"|grep -Po '(?<=")http://imgs.xkcd.com/comics/[^"]+(png|jpg)');echo "$f"|awk '/<img src="http://imgs.xkcd.com/comics/.?" title=./{gsub(/^.title=.|".?$/,"");print}';}
To get a random xkcd comic, I also use the following:
xkcdrandom(){ local f=$(wget -q <a href="http://dynamic.xkcd.com/comic/random/">http://dynamic.xkcd.com/comic/random/ -O -);display $(echo "$f"|grep -Po '(?<=")http://imgs.xkcd.com/comics/[^"]+(png|jpg)');echo "$f"|awk '/<img src="http://imgs.xkcd.com/comics/.?" title=./{gsub(/^.title=.|".?$/,"");print}';}
Continue reading<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category
Insert a comment on command line for reminder
$ ls -alh #mycomment
Comments can be used directly on the command line so I can save in the history a brief description of what command does.
* View this command to comment, vote or add to favourites * View all commands by vgagliardi
commandlinefu.com
by David Winterbottom (codeinthehole.com)
URL: <a href="http://feedproxy.google.com/~r/Command-line-fu/~3/_5hXsFUuAwc/insert-a-comment-on-command-line-for-reminder">http://feedproxy.google.com/~r/Command-line-fu/~3/_5hXsFUuAwc/insert-a-comment-on-command-line-for-reminder