Menu

i need delete cols

2008-09-16
2012-11-13
  • gudix gudix

    gudix gudix - 2008-09-16

    Hi all
    I need delete X cols of a file.
    For example i have a file where i need delete the 6 first colums for later make a compare with the plugin.

    The problem is that i don't know delete this colums in notepad++.

    Thx and soz for my english

     
    • Fool4UAnyway

      Fool4UAnyway - 2008-09-16

      You can SEARCH the forums for answers via the Forums dropdown menu in the Notepad++ bar on top of the page and selecting Search.

      A simple search for "+delete +columns" gets the following results:
      http://sourceforge.net/search/index.php?words=%28%2Bdelete+%2Bcolumns%29&sort=posted_date&sortdir=desc&offset=0&group_id=95717&type_of_search=forums&pmode=0

      You may directly read this thread about similar issues:

      "Very Slow Replacement in Column Selections" (Open Discussion forum)
      http://sourceforge.net/forum/forum.php?thread_id=2019608&forum_id=331753

      You _can_ achieve what you want by doing the following replacement in either Replace dialog (Ctrl+H for the regular, Ctrl+R for the advanced).

      Search for:
      ^......(.)

      Replace by:
      \1

      Check the regular expression radio button or check box.

      Replace all occurrences.

      ^_______ searches for the start of a line
      ._______ searches for any character
      ^......_ searches for the first 6 characters on a line
      (.)_____ searches for any character

      Parentheses are used to be able to re-place this part of the match in the Replace field.

      \1______ re-places the first () grouped expression of the found match

      This re-placing is done because each single match replacement results in finding the "next" first 6 characters on the same line. In effect hitting the Replace button manually a number of times will result in eating up the complete line. A Replace All may avoid this problem, but it is better to be safe than sorry.

      By the way, there is also a great commercial comparison tool called ExamDiff Pro, which allows you to simply ignore any range of characters on all the lines. Using this would avoid the need to remove those characters first.

      www.prestosoft.com/edp_examdiffpro.asp

       
      • Fool4UAnyway

        Fool4UAnyway - 2008-09-19

        When you use the Ctrl+R advanced Replace Dialog you can check the option "1 per line".

        This will avoid the need to re-place any character in order to "tell" the search engine it has to move (on) from the (new) start of the line.

        Find Field:
        ^......

        Clear or leave the Replace Field empty.

        Check the "1 per line" checkbox.

        Replace all occurrences.

        You could even leave the ^ start-of-line anchor out of the regular expression. The first possible location of a string of 6 characters will be at the start of a line anyway.

        That is, unless the cursor position currently isn't at the start of a line. This would be as much a problem for the ^...... regex, too (skipping a correct match), except that this one does not delete anything it is not supposed to.

        Using ^ is safer: be as clear and specific as you can.

         
    • pshute

      pshute - 2008-09-16

      The simplest way is to make a column block then press delete.  See http://notepad-plus.wiki.sourceforge.net/FAQ , under the heading "Does Notepad++ support column mode selection?"

      You might have to add some spaces to the end of the last line, if it's less than 6 characters long.

       
      • Fool4UAnyway

        Fool4UAnyway - 2008-09-17

        Read the title of the thread I referred to before:

        "Very Slow Replacement in Column Selections" (Open Discussion forum)
        http://sourceforge.net/forum/forum.php?thread_id=2019608&forum_id=331753

        To be clear, I hereby explicitly advise not to use the column block mode, because it is _slow_.

        Even if that may not be a problem for a rather limited number of lines, I suggest a solution that someone can use for other things as well.

        Also, your suggestion includes (additional) changes to the file before being able to use it.

         
      • Fool4UAnyway

        Fool4UAnyway - 2008-09-19

        I suppose there aren't any lines with less than 6 characters, or even with only 6 characters.

        But if there are (being any other than the last line), the Column Block deletion may even cause unwanted side effects when "Show all characters" (linebreaks) is turned on.