Need help withTranspose column to row



  • Hello,
    I have this:

    Wavelength LFH00300002.asd
    350 0.34586981
    351 0.34210269
    352 0.35421594
    353 0.34231914
    Wavelength LFH00300003.asd
    350 0.34586981
    351 0.34210269
    352 0.35421594

    and i need this:

    LFH00300002.asd 0.34586981 0.34210269 0.35421594 0.34231914
    LFH00300003.asd 0.34586981 0.34210269 0.35421594

    Can someone help me with this? Thank you.



  • Hello, @ángela-rojas,

    Not very difficult with a regular expression, indeed !

    Assuming that :

    • The word Wavelength, with that exact case, begins a line and is followed by, at least, one space character

    • The different numbers, beginning the following lines, are followed by a single space character

    Just follow the few steps, below :

    • Move back to the very beginning of your file ( Ctrl + Origin )

    • Open the Replace dialog ( Ctrl + H )

    • Type (?-i)^Wavelength +|\R\d+ , in the Find what: box

    • Leave the Replace with: box EMPTY

    • Click on the Replace All button

    Et voilà !

    Notes :

    • The regex search looks, either, for :

      • The string Wavelength, with that exact case, followed by, at least, one space character (+ )

      • Some End of Line characters (\R ), immediately followed by, at least, one digit ( \d+ )

    • Whatever the case found, the overall match is deleted, due to the empty replacement regex

    Best Regards

    guy038

    P.S. :

    • In case the numbers, beginning the line, are followed by several space characters, prefer the regex S/R, below :

    SEARCH (?-i)^Wavelength +|\R(\d+) +

    REPLACE ?1\x20

    • If the search must not be sensitive to case, just change the (?-i) part by the (?i) syntax

Log in to reply