Finding all numbers that are bigger than 1 in vim

2009-12-24 1 min read Fedora Linux Vim Tips

/^([2-9]d*|1d+)
If we have a csv like structure

The trick here is simple, lets look at the regex from the begining:

^ – start from the begining
() – start and end of block
[] – digits within this. So we are looking from 2 to 9 to exclude the numbers begining with 1
d – search for digits

  • – search for one or more
    | – or operation
    1 – search for numbers begining with 1
  • – containing atleast one occurence or more.<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://sparksspace.blogspot.com/2009/10/adding-leading-zeros-in-excel.html">Adding Leading Zeros in Excel (sparksspace.blogspot.com)
  • <li class="zemanta-article-ul-li"><a href="http://blog.creativethink.com/2009/11/the-best-thing-about-2010.html">The Best Thing About &#8221;2010&#8221; (creativethink.com) <li class="zemanta-article-ul-li"><a href="http://www.revenews.com/jackbusch/google-goggles-the-world-is-your-hyperlink/">Google Goggles: The World is Your Hyperlink (revenews.com)
<div class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/e022d83e-669e-4cad-894c-cdab54a1946c/" title="Reblog this post [with Zemanta]"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e34.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

Initialization or clearing of log files

2009-12-22 1 min read Linux

Like all Unix file systems, open log files can cause a real problem when they get too large and need to be deleted. The problem is, if you delete an open file, the link is removed, but all of the inodes are lost. Even worse, if the program continues to log to the file, the link never re-appears, and additional inodes are lost and are unrecoverable. I suggest two solutions to the above problems.

Continue reading

7 Examples for Sed Hold and Pattern Buffer Operations

2009-12-22 0 min read Linux
\"View\"\"More\"Tags\"\"Comments\"\"Share\"\"Send\"\"Favorite\"\"Twitter\"\"Facebook\"

<a href="http://www.flickr.com/photos/35237104750@N01/259102613"><img id="kwiclick-temp-0" title="txt e-book" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/259102613_bd9628c791_m.jpg" alt="txt e-book" />

<dd class="wp-caption-dd zemanta-img-attribution">Image by <a href="http://www.flickr.com/photos/35237104750@N01/259102613">pqs via Flickr

Continue reading

Know when you will type :q in your term instead of vi(m), the alias will chewed you out.

2009-12-20 1 min read Bash Vim Tips

most simple solution is to alias :q like so:
alias :q=`echo &#8221;This is not vim&#8221;`

but as someone suggested in commandlinefu, you can use tput to put some color and fun into this.
alias :q=&#8217;tput setaf 1; echo >&2 &#8221;this is NOT vi(m) :/&#8221;; tput sgr0&#8217;

Change information for the user on Linux machine.

2009-12-19 1 min read Linux

Today I have couple of hours to spare and thus thought might as well spend it on my blog. The finger command in *nix systems is used to display the information on the users. This information is taken from the /etc/passwd file. You can use the chfn command to change the information. Man page for <a href="http://amit.themafia.info/phpMan.php?parameter=chfn&mode=man" target="_blank">chfn.

Chrome – Chromium on Linux (repo)

2009-12-19 1 min read Fedora

Fedora people put up a repo for the chrome web browser and it is quite frequently updated. All you need to do to install the browser is following:

sudo vi /etc/yum.repos.d/chrome.repo

and add the following lines

name=Chromium Test Packages
baseurl=http://spot.fedorapeople.org/chromium/F$releasever/
enabled=1
gpgcheck=0

Once this is done, you can install the browser with yum as follows:

sudo yum install chromium

[[danscartoon]]

Opens Four Google Frames At Once

2009-12-19 0 min read Learning Uncategorized
\"Google
Image via Wikipedia

Googlegooglegooglegoogle: Opens Four <a class="zem_slink" title="Google" rel="homepage" href="http://google.com">Google Frames At Once Googlegooglegooglegoogle (that is Google times 4!) is a simple <a class="zem_slink" title="Website" rel="wikipedia" href="http://en.wikipedia.org/wiki/Website">website/<a class="zem_slink" title="Homepage" rel="wikipedia" href="http://en.wikipedia.org/wiki/Homepage">startpage that puts four Google search windows in one page. It basically displays four frames so that you do not have to leave the page to search simultaneously. This tool is incredibly useful for Google power searchers.
<img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/g4_thumb.png" alt="" align="bottom" />

Continue reading
Older posts Newer posts