Questions tagged [lines]

This tag can refer to rows of characters in text output or input, or to the shortest distance between two points.

This tag can refer to:

  • rows of characters in text output or input;
  • the shortest distance between two points (see also: ).
1223 questions
682
votes
7 answers

Find duplicate lines in a file and count how many time each line was duplicated?

Suppose I have a file similar to the following: 123 123 234 234 123 345 I would like to find how many times '123' was duplicated, how many times '234' was duplicated, etc. So ideally, the output would be like: 123 3 234 2 345 1
user839145
  • 6,883
  • 3
  • 16
  • 10
172
votes
20 answers

count (non-blank) lines-of-code in bash

In Bash, how do I count the number of non-blank lines of code in a project?
Jonathan Hartley
  • 15,462
  • 9
  • 79
  • 80
86
votes
10 answers

Plot multiple lines (data series) each with unique color in R

I am fairly new to R and I have the following queries : I am trying to generate a plot in R which has multiple lines (data series). Each of these lines is a category and I want it to have a unique color. Currently my code is setup in this way…
user1418321
  • 1,191
  • 2
  • 9
  • 6
84
votes
9 answers

Skip first couple of lines while reading lines in Python file

I want to skip the first 17 lines while reading a text file. Let's say the file looks like: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 good stuff I just want the good stuff. What I'm doing is a lot more complicated, but this is the part I'm having trouble…
O.rka
  • 29,847
  • 68
  • 194
  • 309
80
votes
9 answers

Lost code lines when Notepad++ crashed

I was working on a .js file this morning on Notepad++, as usual, when the program just crashed. So I ended it, and re-opened it to see that all my code lines in my .js file, had disappeared, and now all I have left is the file with a size of 0kb…
Netero_sama
  • 823
  • 1
  • 6
  • 7
77
votes
4 answers

More than 1 row in

I'm having troubles getting my to have more than 1 row, I tried adding the properties in the html, like you would do with a normal like this: I even tried to…
Jonas Pedersen
  • 911
  • 2
  • 10
  • 21
63
votes
4 answers

Select range of lines in Notepad++

Is there a way to select range of lines in Notepad++? I would like to write two numbers - from and to, say: from 10000 to 25000. I've got this large MySQL dump file and I can select it only by using some function.
David
  • 1,932
  • 3
  • 27
  • 35
62
votes
16 answers

Count the number of lines in a Java String

Need some compact code for counting the number of lines in a string in Java. The string is to be separated by \r or \n. Each instance of those newline characters will be considered as a separate line. For example - "Hello\nWorld\nThis\nIs\t" should…
Simon Guo
  • 2,776
  • 4
  • 26
  • 35
61
votes
7 answers

Python how to read N number of lines at a time

I am writing a code to take an enormous textfile (several GB) N lines at a time, process that batch, and move onto the next N lines until I have completed the entire file. (I don't care if the last batch isn't the perfect size). I have been reading…
brokentypewriter
  • 787
  • 2
  • 6
  • 8
46
votes
7 answers

Does Eclipse have a way to alphabetically sort lines within a selection of text?

Similar to emacs' M-x sort-lines
Aaron Fi
  • 10,116
  • 13
  • 66
  • 91
45
votes
10 answers

How do I draw lines using XNA?

I've read a bunch of tutorials involving XNA (and it's various versions) and I still am a little confused on drawing primitives. Everything seems to be really convoluted. Can someone show me, using code, the simplest XNA implementation of drawing…
mmcdole
  • 91,488
  • 60
  • 186
  • 222
44
votes
7 answers

Limit numbers of lines in TextView

I have a scrollable textView, and I want to limit the number of lines displayed, however xml properties are not working :
Jerec TheSith
  • 1,932
  • 4
  • 32
  • 41
43
votes
13 answers

remove empty lines from text file with PowerShell

I know that I can use: gc c:\FileWithEmptyLines.txt | where {$_ -ne ""} > c:\FileWithNoEmptyLines.txt to remove empty lines. But How I can remove them with '-replace' ?
Suliman
  • 1,469
  • 3
  • 13
  • 19
43
votes
5 answers

Word wrap in Eclipse Java?

I already have word wrap for Eclipse PHP (How can I get word wrap to work in Eclipse PDT for PHP files?). What about Eclipse Java? Is there a similar tool to wrap Java code lines?
sandalone
  • 41,141
  • 63
  • 222
  • 338
42
votes
9 answers

Efficient maths algorithm to calculate intersections

For a game I am developing I need an algorithm that can calculate intersections. I have solved the problem, but the way I have done it is really nasty and I am hoping someone here might have a more elegant solution. A pair of points represent the…
Mitch
1
2 3
81 82