shell — one liner to selectively change case

2010-01-07 2 min read Bash

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 reading

Get list of git repositories from command line.

2009-10-04 3 min read Linux

Earlier I had posted a small blog on teamgit. The problem still is that you have to manually go to the git.kernel.org page and get the list of the repo’s that you can download. How about a command line to get the same. Here’s one:

wget -O – http://git.kernel.org |grep &#8221;class=.list.&#8221; |grep -v title|awk -F&#8217;>&#8217; '{print $3}&#8217;|sed &#8217;s/<\/a//&#8217;

Output will be like this:<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/ghaskins/linux-2.6-hacks.git

<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/ghaskins/preempt-test.git
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/ghaskins/schedtop.git
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/glommer/linux-2.6-x86-pvops.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gregkh/bti.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gregkh/ddk.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gregkh/driver-core-2.6.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gregkh/lkn.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gregkh/patches.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gregkh/tty-2.6.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gregkh/usb-2.6.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gregkh/usbutils.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gregkh/usbview.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gud/chunkfs-tools.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gud/chunkfs.git <div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">linux/kernel/git/gud/fuse-chunkfs.git <p style="padding-left: 60px;"><span style="text-decoration: underline;"><span style="color: #0000ff;">linux/kernel/git/ghaskins/linux-2.6-hacks.git

Continue reading

Script to generate a html file with link to all files in directory

2009-09-26 1 min read Bash GNOME Linux

ls -1 |awk -F&#8221;.&#8221; '{print  &#8221;

&#8221;,$2,&#8221;.&#8221;,$3,&#8221;

&#8221; ;}&#8217; > index1.html

And if you want to do it recursively

ls -1R |awk -F&#8221;.&#8221; '{print  &#8221;

&#8221;,$2,&#8221;.&#8221;,$3,&#8221;

&#8221; ;}&#8217; > index1.html

Newer posts