Friday, June 24, 2011

display all lines starting without a character

grep -vE ^' ' temp ==> display all lines in temp starting without a space.
grep -vE ^x temp ==> display all lines in temp, not starting with space

Friday, January 14, 2011

highlight chars more than 80 chars in vim

it would be useful sometime while formatting code, you might want to see the characters more than 80 chars wide in vim.

:match ErrorMsg '\%>80v.\+'


this will highlight the chars from 81st character in a line.

Wednesday, December 15, 2010

remove Ctrl-M characters in unix

a file edited using windows format might have ^M at the end of each line.
This would be annoying when it comes to the unix world.
Two easy ways to remove this -
1. dos2unix command

2. Vim search & replace

:%s/^V^M//g [ type Ctrl-V Ctrl-M]

this will translate to

:%s/^M//g [ remember Ctrl-V is escape sequence in Unix]

Thursday, April 1, 2010

now bangalore autowallas can speak about 'IT'

recently i was travelling to cantonment railway station taking an auto from thipasandra. Initially
i was surprised when the autowalla talked to me in english. He started asking where I work for, my onsite experience and all the IT related stuffs. he even asked me about the technology that I
work on. When i said that i work in software, he asked Java or .NET!!! huhh!!!. He even asked me about Obama's IT policy and asked if that would have any impact on IT in bangalore. oh man, how come you know all these facts?!!! He know that IT in bangalore is their bread and butter for the autowallas. wowww people are raising ahead by trying to learn something.. good..

tabs in vim

Sometimes it would useful to view the files as tabs(IMV, may be, just may be only when you
want to know what files are open without doing :files in vim command prompt. ). Here is
the solution for it.

http://www.linux.com/archive/feed/59533

here is the gist of the feature.

1. You could invoke it either with -p command switch option or :tabnew command option.
2. use 'gt' to switch between the tabs.
3. Use ':tabdo blah' to run a command over all the tabs ( eg. search and replace)

its cool

Friday, October 23, 2009

diwali without pollution

its been long since i blogged coz of the so call hectic work :-) huhh itz human to _create_ excuses. the same time last weekend, i was having high blood pressure, guess why., diwali crackers were bursting my mind from all the possible directions. oh god, our ears can't bear this amout of dB.
for 3 continous days it was just bursting till 11pm. though it is the case, i slept at my normal time of 10 pm :-) the next morning when i stepped out, it is full of polluted air. but we can't help it. people letting out their childishness atleast three days in a year - its good in one way. i am just thinking if there isn't a way to celebrate without noise and sound pollution. our neighbour aunty had lit her house all around with oil lamps... awesome sight. it was so pleasing you know. the house itself had got a facelift. i was just appreciating this aunty and she jumped to road with a bomb and it literally rendered my ear out of service for a moment!!

i think pleasant lighting is the way i like to celebrate diwali.. may be next diwali i would lit my home..

Tuesday, August 4, 2009

bash back to olden days

for some reason i don't like coloured text in tty. Linux, by defaut sets weird colour for any display in tty. For example tar files will be listed ( as part of ls output) as red... weird.. but i would love to see it in old unix style.
here is how you could do it.

a) copy /etc/DIR_COLORS to /home/urloginName/.dir_colours
b) change "COLOR tty" to "COLOR none"