Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is it possible to move a column where column on right is variable width

10 views
Skip to first unread message

Angus Comber

unread,
May 16, 2017, 12:34:05 PM5/16/17
to
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 tried using rectangles, eg:

set mark at top left buffer, C-space
select area, ie selected area is all of Symbols column
Then c-x r k to remove the symbols from 1st column and save to the rectangle kill ring.
then I replace $ with tab.

Then I navigate to the end of the first line and try c-x r y - but that inserts the symbols into the middle of the Descriptions.

Is there any way to do what I want?

Ben Bacarisse

unread,
May 16, 2017, 10:05:03 PM5/16/17
to
Angus Comber <angus...@gmail.com> writes:

> 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.

It would help to show the output you want.

> I tried using rectangles, eg:

This would be the method of choice if you want the symbols to be lined
up. If "Description<tab>Symbol" means you want one tab character
between the two, use a regex replace:

M-x replace-regexp RET
\(.*\) \(.*\)RET
\2 \1RET

(I typed a tab between ) and \ and 2 and \ but it might get mauled by
some part of the mail sending)

<snip>
--
Ben.

Loris Bennett

unread,
May 17, 2017, 2:22:52 AM5/17/17
to
You could convert to a an Org mode table, reorder the columns and, if
needed, convert back to plain(er) text:

1. M-x orgtbl-mode
2. Highlight the lines
3. Do C-c | (or M-x orgtbl-create-or-convert-from-region)
4. With the cursor in the left-hand column, do M-<right arrow>
5. Replace the |-symbols

Cheers,

Loris

--
This signature is currently under construction.
0 new messages