Line Number



  • I downloaded the following file
    http://www.gutenberg.org/files/2701/2701-0.txt

    If I search for “CHAPTER 1. Loomings.”
    using notepad in windows, it is found in line 850.
    using notepad++, it is found in line 1699.
    Why there is a difference in line number?
    Thanks.



  • @Mohamed-Elgoussi said:

    “CHAPTER 1. Loomings.”

    well I find it twice, line 48 and line 850.

    What is the last line number in your document?

    Cheers
    Claudia



  • @Claudia-Frank said:

    I am talking about line 850.
    If I view the file via notepad in windows, it is found in line 850, while last line is 22335
    If I view the file via notepad++, it is found in line 1699, while last line is 44669



  • @Mohamed-Elgoussi

    I would assume that the document was pasted twice in notepad++ and the cursor
    is placed after line 850 (or at least after the word loomings) when doing the search.
    Make sure that the cursor is on line 1 by clicking into it before searching for the word.
    As said, it is working for me.

    Cheers
    Claudia



  • Hello, @mohamed-elgoussi,

    If I view the file via notepad in windows, it is found in line 850, while last line is 22335
    If I view the file via notepad++, it is found in line 1699, while last line is 44669

    It’s easy to notice that 44669 = 22335 + 22334 and that 1699 = 850 + 849

    So, I suppose that, when you pasted the contents of your 2701-0.txt file, you probably did it twice !!

    With my N++ v7.5.1 version, I do obtain 2 occurrences of the CHAPTER 1. Loomings. string, at column 1 of the two lines 48 and 850, with the options Normal search and Wrap around :-)


    For information, your UTF-8 file contains 22,334 lines, of 71 characters max, for a total of 1,276,200 bytes

    This total can be broken down into :

             1,208,075 characters, coded in 1 byte   =>  1,208,075 bytes
                    48 characters, coded in 2 bytes  =>         96 bytes
                 7,787 characters, coded in 3 bytes  =>     23,361 bytes
            ----------                                   ---------
    CHARS    1,215,910 characters                        1,231,532 bytes
    		 
                22,334 characters Carriage Return (CR)      22,334 bytes
                22,334 characters Line Feed       (LF)      22,334 bytes
            ----------                                   ---------
    TOTAL    1,260,578 characters                        1,276,200 bytes                     
    

    Best Regards,

    guy038



  • Dear Sir,
    I have not pasted any thing twice.
    in R I run the following:
    download.file(“http://www.gutenberg.org/files/2701/2701-0.txt”, “xx.txt”) in R
    scan(“xx.txt”, what = “”, skip = 849, nlines = 1)
    [1] “CHAPTER” “1.” “Loomings.”
    i.e. which means that CHAPTER 1. Loomings. exists in line 850 not 1699 (as it is shown in file via notepad+).
    Thanks



  • Hello, @mohamed-elgoussi,

    I don’t understand ! Downloading from your second post, the contents, I obtain exactly the same file as before !

    You say :

    which means that CHAPTER 1. Loomings. exists in line 850 not 1699 (as it is shown in file via notepad+)

    I’m sorry to insist, but, in my Notepad++ v7.5.1, I do have an occurrence of CHAPTER 1. Loomings., in line 850, and nothing, in line 1699 !

    BTW the line 1699 is a pure blank line, surrounded by the text, as below :

    his teeth, sprang into bed with me. I sang out, I could not help it
    now; and giving a sudden grunt of astonishment he began feeling me.
    
    Stammering out something, I knew not what, I rolled away from him
    against the wall, and then conjured him, whoever or whatever he might
    

    I don’t see. Hope that someone else will understand your problem !

    Cheers,

    guy038





  • The end of line is screwed, probably something like <CR><LF><LF>, Notepad++ sees every line as a line + blank line.
    So Line number in Notepad++ is multiplied by 2.


Log in to reply