vi puzzles

Joel Hammer joel
Mon May 17 12:00:38 PDT 2004


I am not really good in vi(m) for doing fancy editing. You can use any
bash tool you want in vim like so:
:1,$ ! cut -d" " -f1,2   
and so on.

To insert columns, something like sed might be nice, eg.
:1,$ ! sed "s/\([a-z] \)\{3,\}/&NewColumn /"

Which says to look for the third column, with all your
columns being lower case text followed by spaces, and
replace it with the same column and NewColumn.  Once you
start using sed and other editing tools with vim, you
are addicted.

If you mess up, just press the u button. 

If you are not using vim, I would switch to it.

BTW, I find that working with columns is much easier in
a spreadsheet.

Joel


On Tue, Mar 16, 2004 at 08:07:23AM +0800, M.W. Chang wrote:
> 
> How could I do column insert, column delete and column move in vi 
> editor? It's not easy to find a reference in google.com
> 
> -- 
>   .~.    http://toylet.homeip.net
>  / v \   Linux 2.4.22-xfs
> /( _ )\  8:04am up 3 days 11:29
>   ^ ^    load average: 1.00 1.00 0.97
> 
> _______________________________________________
> Linux-users mailing list
> Linux-users at smtp.linux-sxs.org
> Unsubscribe/Suspend/Etc -> 
> http://smtp.linux-sxs.org/mailman/listinfo/linux-users



More information about the Linux-users mailing list