Adding Quotes on Selective Lines

Adding Quotes on Selective Lines

3
NewbieNewbie
3

    Nov 08, 2006#1

    I have a series of lines, names and address type stuff that came out in a funky format. To now import them into another system I need to put quotes (" ") around all the lines EXCEPT first and last line in a series.

    Each series is separated by 1 or 2 blank lines

    I am using the latest UltraEdit 12.20a+2 and could not figure out a viable regular expression yet based on what I have seen it seems like there should be one with the new Perl compatible engine.

    thanks for any help and ideas

    Alan


    Sample:

    sdfsa, bas,fsdf,adf,adsfafds,asdf,
    ddflk,asd,df
    sadfasdf,sadf,sdf
    sadsadf,adfs,adsf


    df adsf,sadf,asdf,sadf,sadf,
    32 das fadf,adf
    sa,df sadf

    asdd fad fasdfasdfasdf,asd
    23324 dsaf
    3232,adfs,sadf,dsd
    233223,4sd,asdf,sad
    2323sd,dsf ,,dsfadfasdfsadf



    sdfsa, bas,fsdf,adf,adsfafds,asdf,
    ddflk,asd,df
    sadfasdf,sadf,sdf
    sadsadf,adfs,adsf


    df adsf,sadf,asdf,sadf,sadf,
    32 das fadf,adf
    sa,df sadf

    asdd fad fasdfasdfasdf,asd
    23324 dsaf
    3232,adfs,sadf,dsd
    233223,4sd,asdf,sad
    2323sd,dsf ,,dsfadfasdfsadf



    Turn the above into:


    sdfsa, bas,fsdf,adf,adsfafds,asdf,
    "ddflk,asd,df"
    "sadfasdf,sadf,sdf"
    sadsadf,adfs,adsf


    df adsf,sadf,asdf,sadf,sadf,
    "32 das fadf,adf"
    sa,df sadf

    asdd fad fasdfasdfasdf,asd
    "23324 dsaf"
    "3232,adfs,sadf,dsd"
    "233223,4sd,asdf,sad"
    2323sd,dsf ,,dsfadfasdfsadf

    6,608550
    Grand MasterGrand Master
    6,608550

      Nov 09, 2006#2

      Very good, you have posted your UltraEdit version and a before and after example. So it was no problem for me to write a macro for this job:

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Bottom
      IfColNum 1
      "
      "
      Else
      "

      "
      EndIf
      Top
      "

      "
      TrimTrailingSpaces
      Top
      Find RegExp "%^([~^p]*^)$"
      Replace All ""^1""
      Find RegExp "^p^p"^(*^)"$"
      Replace All "^p^p^1"
      Find RegExp "%"^([~"]+^)"^p^p"
      Replace All "^1^p^p"
      Bottom
      DeleteLine
      Top
      DeleteLine
      DeleteLine

      Add UnixReOn or PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.
      Best regards from an UC/UE/UES for Windows user from Austria