Is it possible to skip columns in column mode?



  • Hi,

    Let’s say I have the following text:

    12345
    23456
    34567
    45678

    I want to make it:

    1 2 3 4 5
    2 3 4 5 6
    3 4 5 6 7
    4 5 6 7 8

    It would be great if it was possible to do selecting columns once and doing: space, move to the right, space, move to the right etc.
    Unfortunately once I click right arrow the column selection disappears and I need to select all the columns again (which is a problem when I have a lot of rows to edit in a long file). Is there any way to do this move to the right without losing the column selection mode?



  • I don’t believe so. May I suggest a regular expression search-and-replace?



  • Yeah, I am writing Python scripts for anything more complicated anyway but that feature would be just very convenient for quick editing. Writing a regular expression to match what is in the columns is more work than writing a script on the side anyway.



  • Hello Piotr,

    May be you’re not very acquainted to regular expressions, but the search/replacement, below, is quite easy to understand :-)

    • Open the Replace dialog ( CTRL + H )

    • Select the Regular expression search mode

    • SEARCH (?-s).

    • REPLACE $0 with a SPACE after the digit 0

    • Click on the Replace All button

    Et voilà ! Not difficult, isn’t it ?

    Notes :

    • The . ( DOT ) represents any standard character, different from the three EOL characters ( \r, \n and \f )

    • The form (?-s), located at the beginning, forces the dot to be a standard character only ( just in case you previously checked the . matches newline option ! ). It’s a general option, meaning that the subject text won’t be considered as a Single line, with standard and EOL characters mixed.

    • The syntax $0, in the replacement string, simply represents the searched string, that is to say any standard character found. And, after each character re-written, we just add a single space !

    Of course, with the Python Script plugin, you may save this specific S/R, in a script, for later use :-)

    Best Regards

    guy038



  • guy038,
    I don’t think it was a matter of not understanding regex for Piotr, it was a matter of looking for a lighterweight solution, and in the best-case, a built-in solution. I also think that his data set was probably contrived and not really typical of the data he’s handling, but something to discuss his conceptual desire with.



  • Yeah, this was just a sample data. It’s usually way more columns of various stuff in them (numbers, mixes strings, names, addresses etc.), sometimes white spaces as well. Sometimes I want to do: space->right->space->right->space->right->right->delete one row->copy pate 4 next rows->left x10->paste

    Right now I need to re-select every time for a simple task of moving in what is in one column somewhere else and inserting some spaces between other columns. It’s faster (for me) to write a Python script to handle that than use regular expression search/replace but it would be instant if there was a way to move one column to left and right without losing the column selection more.

    Anyway, thanks for help :)


Log in to reply