help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is it possible to move a column where column on right is variable wi


From: hector
Subject: Re: Is it possible to move a column where column on right is variable width
Date: Thu, 18 May 2017 08:17:29 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, May 16, 2017 at 09:34:02AM -0700, Angus Comber wrote:
> I downloaded a file, LSE.txt from this link:
> 
> http://www.eoddata.com/Data/symbollist.aspx?e=LSE
> 
> which is of the form:
> 
> symbol<tab>Description
> 
> the description is pretty free form.  Here are some examples:
> 
> 06GG.L        BARCLAYS BANK PLC UNDATED FLTG RATE PRIM CAP NOTES'2'USD
> 06GL.L        NATIONAL GRID GAS 8.75% BDS 27/6/25 GBP(VAR)
> 07OZ.L        HAMMERSON PLC 6.875% BDS 31/3/20 GBP(VAR)
> 
> What I would like to do is swap so it displays:
> Description<tab>Symbol.

I think it is already solved but just another approach.
Lately I tend to use macros for a lot of things.
It is a way of programming without having to know
the syntax. Very easy and very powerful if you don't care
much about efficiency.

Record this macro:
C-SPC                               ; set mark at the beginning
M-x search-forward RET C-q TAB RET  ; go past the first TAB
C-b                                 ; go backwards
C-d                                 ; delete TAB
C-w                                 ; kill region (the first field)
C-e                                 ; go to end of line
C-q TAB                             ; insert TAB
C-y                                 ; yank the first field

Then just repeat it for all the lines (apply-macro-to-region-lines)
and that's it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]