Re: swapping three columns in a file..
How to swap the three columns in file without using substitute command? Hi, I don't understand why you can't use :s so I don't know if the following solution would be usable for you. defining: qq/\/\/BOF\Enterjj^V/\/\/EOF\Enterkkf dA ^Cp Enter means Enter key ^V and ^C mean ctrl-V and ctrl-C using: @q The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Please use an e-mail account administered by someone inteligent, who doesn't put these (or similar) stupid and arrogant automatic footers. You are posting an e-mail to the list and there are clear rules of that list. One well known property of it is HTML mirroring readable by anybody on the world. If you don't agree with this, don't send any electronic message to it. The same about viruses. Instead of sending them with a warning that it is a recipient's problem to get a virus (which is really very arrogant warning!!) don't send viruses at all :-) I hope this is your misunderstanding, you probably use an employer's e-mail server instead of getting your own personal e-mail account for personal e-mails. Please change it. Milan Vancura -- Milan Vancura, Prague, Czech Republic, Europe
RE: swapping three columns in a file..
Hope following command is quite easy to manipulate, Mark the first line as mt, then use awk to swap the columns 't,. !awk '{print $3 $2 $1}' Thanks Regards, Sasikumar Kandhasamy Project Engineer Wipro Technologies Madivala-1|Bangalore. Mobile- +91-9986378586 | Phone: 30292842 Dreams into Thoughts and Thoughts into Actions -- Dr. A P J Abdul Kalam -Original Message- From: Milan Vancura [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 19, 2006 1:55 PM To: Sasikumar Kandhasamy (WT01 - TELECOM SERVICE PROVIDER) Cc: Vim development list Subject: Re: swapping three columns in a file.. How to swap the three columns in file without using substitute command? Hi, I don't understand why you can't use :s so I don't know if the following solution would be usable for you. defining: qq/\/\/BOF\Enterjj^V/\/\/EOF\Enterkkf dA ^Cp Enter means Enter key ^V and ^C mean ctrl-V and ctrl-C using: @q The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Please use an e-mail account administered by someone inteligent, who doesn't put these (or similar) stupid and arrogant automatic footers. You are posting an e-mail to the list and there are clear rules of that list. One well known property of it is HTML mirroring readable by anybody on the world. If you don't agree with this, don't send any electronic message to it. The same about viruses. Instead of sending them with a warning that it is a recipient's problem to get a virus (which is really very arrogant warning!!) don't send viruses at all :-) I hope this is your misunderstanding, you probably use an employer's e-mail server instead of getting your own personal e-mail account for personal e-mails. Please change it. Milan Vancura -- Milan Vancura, Prague, Czech Republic, Europe The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
Re: swapping three columns in a file..
[EMAIL PROTECTED] wrote: How to swap the three columns in file without using substitute command? Let us say file with the following contents, A1 B1 C1 A2 B2 C2 Then after swapping the file content should be, C1 A1 B1 C2 A2 B2 There's visswap, which you can get from http://mysite.verizon.net/astronaut/vim/index.html#VISSWAP (and as mentioned in http://vim.sourceforge.net/tips/tip.php?tip_id=329) With it, you can a) visually select a column using visual blocks (ctrl-v and move cursor) b) press ctrl-y(sort of a yank) c) visually select another column using visual blocks c) press ctrl-x(exchange) Works with V and v (visually selected lines, visually selected characters), too. So: 1) swap columns A C 2) swap columns B A Regards, Chip Campbell
swapping three columns in a file..
Hi All, How to swap the three columns in file without using substitute command? Let us say file with the following contents, //BOF A1 B1 C1 A2 B2 C2 //EOF. Then after swapping the file content should be, //BOF C1 A1 B1 C2 A2 B2 //EOF Thanks Regards, Sasikumar Kandhasamy Project Engineer Wipro Technologies Madivala-1|Bangalore. Mobile- +91-9986378586 | Phone: 30292842 Dreams into Thoughts and Thoughts into Actions -- Dr. A P J Abdul Kalam The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com