Saari Development

Ali Rizvi's Technical Blog as a Professional Software Development Engineer

vim extracting first column (space delimited)

leave a comment »

Just figured out how to extract a single (first) column from a file containing text

:%s/^\(\w\+\)\.\*/\1/g

I am sure there is a better way to do this but this is best I can get for now. I don’t like the excessive escaping vim requires in regex.

PS: Just figured out that you have to have:

:set nomagic

for the above subsitution to work.

Advertisements

Written by imsaar

February 19, 2006 at 7:26 pm

Posted in general

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: