Merging or Joining every 7 lines in a text file using notepad++



  • EMAIL: swmorton50@gmail.com
    CALLSIGN: AA4TI
    NAME: STEPHEN MORTON
    ADDRESS: 5644 CANTUCCI STREET
    ADDRESS-CITY: NOKOMIS
    ADDRESS-STATE-PROVINCE: FL
    ADDRESS-POSTALCODE: 34275
    EMAIL: robertumpleby@tx.rr.com
    CALLSIGN: AA5AH
    NAME: ROBERT UMPLEBY
    ADDRESS: 1209 N WATERVIEW DR
    ADDRESS-CITY: RICHARDSON
    ADDRESS-STATE-PROVINCE: TX/DALLAS
    ADDRESS-POSTALCODE: 75080
    EMAIL: aa5au@bellsouth.net
    CALLSIGN: AA5AU
    NAME: DON HILL
    ADDRESS: 2121 SUTHERLAND PLACE
    ADDRESS-CITY: HARVEY
    ADDRESS-STATE-PROVINCE: LA
    ADDRESS-POSTALCODE: 70058
    EMAIL: rickmaxey51@yahoo.com
    CALLSIGN: AA5TL
    NAME: RICHARD MAXEY, JR.
    ADDRESS: 19708 MAHOGANY ST
    ADDRESS-CITY: BEND
    ADDRESS-STATE-PROVINCE: OR
    ADDRESS-POSTALCODE: 97702
    EMAIL: AA1SU@arrl.net
    CALLSIGN: AA1SU
    NAME: PAUL N. GAYET
    ADDRESS: 11 CHERRY STREET
    ADDRESS-CITY: ESSEX JUNCTION
    ADDRESS-STATE-PROVINCE: VT
    ADDRESS-POSTALCODE: 05452
    EMAIL: skeeter_1@yahoo.com
    CALLSIGN: AA3C
    NAME: RICHARD PETERS
    ADDRESS: 945 BEECHWOOD DR.
    ADDRESS-CITY: MURPHY
    ADDRESS-STATE-PROVINCE: TX
    ADDRESS-POSTALCODE: 75094

    I have a .txt file as above and I want to merge every 7 lines into one. Maybe some one can help me with this



  • You might try:

    Open the Replace dialog by pressing Ctrl+h and then set up the following search parameters:

    Find what box: (?-s)(.+)\R(.+)\R(.+)\R(.+)\R(.+)\R(.+)\R(.+)(?=\R)
    Replace with box: \1 \2 \3 \4 \5 \6 \7
    Search mode radiobutton: Regular expression
    Match whole word only checkbox: unticked (and disabled)
    Wrap around checkbox: ticked
    . matches newline checkbox: doesn’t matter (because the (?-s) leading off the Find what box contains an s variant)

    Then press the Replace All button.

    After the replacement, take care that the last grouping of 7 lines is done correctly. Adjust manually if necessary.



  • Hello, @robert-baker, @alan-kilborn, and All,

    An other solution could be :

    SEARCH (?-i)\R+(?!EMAIL|\z)

    REPLACE \x20

    This alternate solution does not mind if additional line-break separates each section ;-))

    For instance, the input text :

    EMAIL: swmorton50@gmail.com
    CALLSIGN: AA4TI
    NAME: STEPHEN MORTON
    ADDRESS: 5644 CANTUCCI STREET
    ADDRESS-CITY: NOKOMIS
    ADDRESS-STATE-PROVINCE: FL
    ADDRESS-POSTALCODE: 34275
    
    
    
    EMAIL: robertumpleby@tx.rr.com
    CALLSIGN: AA5AH
    NAME: ROBERT UMPLEBY
    ADDRESS: 1209 N WATERVIEW DR
    ADDRESS-CITY: RICHARDSON
    ADDRESS-STATE-PROVINCE: TX/DALLAS
    ADDRESS-POSTALCODE: 75080
    
    EMAIL: aa5au@bellsouth.net
    CALLSIGN: AA5AU
    NAME: DON HILL
    ADDRESS: 2121 SUTHERLAND PLACE
    ADDRESS-CITY: HARVEY
    ADDRESS-STATE-PROVINCE: LA
    ADDRESS-POSTALCODE: 70058
    
    
    EMAIL: rickmaxey51@yahoo.com
    CALLSIGN: AA5TL
    NAME: RICHARD MAXEY, JR.
    ADDRESS: 19708 MAHOGANY ST
    ADDRESS-CITY: BEND
    ADDRESS-STATE-PROVINCE: OR
    ADDRESS-POSTALCODE: 97702
    EMAIL: AA1SU@arrl.net
    CALLSIGN: AA1SU
    NAME: PAUL N. GAYET
    ADDRESS: 11 CHERRY STREET
    ADDRESS-CITY: ESSEX JUNCTION
    ADDRESS-STATE-PROVINCE: VT
    ADDRESS-POSTALCODE: 05452
    EMAIL: skeeter_1@yahoo.com
    CALLSIGN: AA3C
    NAME: RICHARD PETERS
    ADDRESS: 945 BEECHWOOD DR.
    ADDRESS-CITY: MURPHY
    ADDRESS-STATE-PROVINCE: TX
    ADDRESS-POSTALCODE: 75094
    
    
    
    

    would output :

    EMAIL: swmorton50@gmail.com CALLSIGN: AA4TI NAME: STEPHEN MORTON ADDRESS: 5644 CANTUCCI STREET ADDRESS-CITY: NOKOMIS ADDRESS-STATE-PROVINCE: FL ADDRESS-POSTALCODE: 34275 
    EMAIL: robertumpleby@tx.rr.com CALLSIGN: AA5AH NAME: ROBERT UMPLEBY ADDRESS: 1209 N WATERVIEW DR ADDRESS-CITY: RICHARDSON ADDRESS-STATE-PROVINCE: TX/DALLAS ADDRESS-POSTALCODE: 75080 
    EMAIL: aa5au@bellsouth.net CALLSIGN: AA5AU NAME: DON HILL ADDRESS: 2121 SUTHERLAND PLACE ADDRESS-CITY: HARVEY ADDRESS-STATE-PROVINCE: LA ADDRESS-POSTALCODE: 70058 
    EMAIL: rickmaxey51@yahoo.com CALLSIGN: AA5TL NAME: RICHARD MAXEY, JR. ADDRESS: 19708 MAHOGANY ST ADDRESS-CITY: BEND ADDRESS-STATE-PROVINCE: OR ADDRESS-POSTALCODE: 97702
    EMAIL: AA1SU@arrl.net CALLSIGN: AA1SU NAME: PAUL N. GAYET ADDRESS: 11 CHERRY STREET ADDRESS-CITY: ESSEX JUNCTION ADDRESS-STATE-PROVINCE: VT ADDRESS-POSTALCODE: 05452
    EMAIL: skeeter_1@yahoo.com CALLSIGN: AA3C NAME: RICHARD PETERS ADDRESS: 945 BEECHWOOD DR. ADDRESS-CITY: MURPHY ADDRESS-STATE-PROVINCE: TX ADDRESS-POSTALCODE: 75094 
    

    Best Regards,

    guy038


Log in to reply