Questions tagged [line]

The shortest distance between two points. Or, a row of characters in text output.

is mostly used in below context:

  • text line or command line in text processing context;
  • line drawing or plotting in visualization or image-processing context
  • analytic geometry

For the LINE-API / LIFF use line-api or line-messenger

6255 questions
540
votes
13 answers

Reading a file line by line in Go

I'm unable to find file.ReadLine function in Go. How does one read a file line by line?
g06lin
  • 5,725
  • 3
  • 18
  • 13
448
votes
7 answers

Get line number while using grep

I am using grep recursive to search files for a string, and all the matched files and the lines containing that string are print on the terminal. But is it possible to get the line numbers of those lines too?? ex: presently what I get is…
sai
  • 4,907
  • 4
  • 24
  • 18
298
votes
5 answers

Go to first line in a file in vim?

How do I go to first line in a file in vim ?
Jean
  • 21,665
  • 24
  • 69
  • 119
294
votes
33 answers

Add centered text to the middle of a horizontal rule

I'm wondering what options one has in xhtml 1.0 strict to create a line on both sides of text like-so: Section one ----------------------- Next section ----------------------- Section two I've thought of doing some fancy things like this:
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
286
votes
30 answers

How to read specific lines from a file (by line number)?

I'm using a for loop to read a file, but I only want to read specific lines, say line #26 and #30. Is there any built-in feature to achieve this?
eozzy
  • 66,048
  • 104
  • 272
  • 428
270
votes
17 answers

C read file line by line

I wrote this function to read a line from a file: const char *readLine(FILE *file) { if (file == NULL) { printf("Error: file pointer is null."); exit(1); } int maximumLineLength = 128; char *lineBuffer = (char…
lron
  • 2,717
  • 2
  • 16
  • 3
252
votes
9 answers

How do you run a command eg chmod, for each line of a file?

For example, right now I'm using the following to change a couple of files whose Unix paths I wrote to a file: cat file.txt | while read in; do chmod 755 "$in"; done Is there a more elegant, safer way?
hawk
  • 2,655
  • 2
  • 16
  • 11
224
votes
29 answers

Circle line-segment collision detection algorithm?

I have a line from A to B and a circle positioned at C with the radius R. What is a good algorithm to use to check whether the line intersects the circle? And at what coordinate along the circles edge it occurred?
Mizipzor
  • 51,151
  • 22
  • 97
  • 138
220
votes
5 answers

How do cache lines work?

I understand that the processor brings data into the cache via cache lines, which - for instance, on my Atom processor - brings in about 64 bytes at a time, whatever the size of the actual data being read. My question is: Imagine that you need to…
Norswap
  • 11,740
  • 12
  • 47
  • 60
204
votes
12 answers

How to split strings over multiple lines in Bash?

How can i split my long string constant over multiple lines? I realize that you can do this: echo "continuation \ lines" >continuation lines However, if you have indented code, it doesn't work out so well: echo "continuation \ …
user880248
186
votes
25 answers

How to add a line break in an Android TextView?

I am trying to add a line break in the TextView. I tried suggested \n but that does nothing. Here is how I set my texts. TextView txtSubTitle =…
dropsOfJupiter
  • 6,763
  • 12
  • 47
  • 59
183
votes
17 answers

Vertical line using XML drawable

I'm trying to figure out how to define a vertical line (1dp thick) to be used as a drawable. To make a horizontal one, it's pretty straightforward:
Kaspa
  • 2,169
  • 3
  • 16
  • 18
183
votes
13 answers

Remove empty lines in text using Visual Studio or VS Code

How to remove empty lines in Visual Studio?
174
votes
9 answers

Set line spacing

How can I set line spacing with CSS, like we can set it in MS Word?
Moon
  • 19,518
  • 56
  • 138
  • 200
171
votes
12 answers

How to remove newlines from beginning and end of a string?

I have a string that contains some text followed by a blank line. What's the best way to keep the part with text, but remove the whitespace newline from the end?
Dylan Wheeler
  • 6,928
  • 14
  • 56
  • 80
1
2 3
99 100