Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Delete blank line at the begin of files

2. Help
Asma
2013-09-28
2013-09-29
  • Asma
    Asma
    2013-09-28

    Hi All

    I have a lot of files, with empty single line at the beginning of files. How can I remove it?

    Thank you in advance.

     
  • THEVENOT Guy
    THEVENOT Guy
    2013-09-29

    Hello Asma,

    It's quite easy to get rid of initial blank lines, at the beginning of a file, using PCRE regular expressions of Notpad++ !

    • Open the Search/Replacement dialog, with the CTRL + H shortcut

    • Set the Regular expression button radio

    • In the SEARCH field, type in : \A\R+

    • Leave the REPLACEMENT field empty

    • Click on the Replace All buttton

    Et voilà !

    NOTES

    \A is an assertion which MUST be verified by the regex and represents the VERY start of the file. It must be written in UPPERCASE, because the regex \a stands for the BEL character (\x07)

    \R+ represents a NON NULL list of ANY consecutive EOL. Note that an UNIQ \R stands for \r\n, in a Windows file, for \n, in an Unix file or for \r, in an old Mac file.

    Best regards,

    guy038

    P.S. :

    • If the blank lines, at the beginning of YOUR file, may contains some blank characters, use this regex, instead :

    SEARCH : \A(\h*\R)+

    \h* represents the longest string, possibly null, of any of the 3 horizontal blank characters ( \x20 = SPACE, \x09 = TABULATION and \xA0 = NO-BREAK SPACE ), before the EOL.

    • You will find good documentation, about the new Perl Common Regular Expressions (PCRE), used by N++, since the 6.0 version, at the TWO addresses below :

    http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html

    http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html

    The FIRST link concerns the syntax of regular expressions in SEARCH

    The SECOND link concerns the syntax of regular expressions in REPLACEMENT

     
    Last edit: THEVENOT Guy 2013-09-29
  • Asma
    Asma
    2013-09-29

    Great! ( :

    Thanks a lot THEVENOT Guy.