Questions tagged [line-by-line]

Line By Line is a NodeJS module that helps you reading large text files, line by line, without buffering the files into memory.

114 questions
170
votes
5 answers

How can I profile Python code line-by-line?

I've been using cProfile to profile my code, and it's been working great. I also use gprof2dot.py to visualize the results (makes it a little clearer). However, cProfile (and most other Python profilers I've seen so far) seem to only profile at the…
rocketmonkeys
  • 5,473
  • 5
  • 28
  • 21
44
votes
3 answers

How to read a CSV file from a stream and process each line as it is written?

I would like to read a CSV file from the standard input and process each row as it comes. My CSV outputting code writes rows one by one, but my reader waits the stream to be terminated before iterating the rows. Is this a limitation of csv module?…
muhuk
  • 15,777
  • 9
  • 59
  • 98
38
votes
3 answers

Bash: read a file line-by-line and process each segment as parameters to other prog

I have some dirty work to do, so a Bash script seems to be a good choice. I'm new to Bash, and the experience makes me kind of frustrated. The file mapfiles.txt consists of lines as follow. Each line has four segments separated by a white space.…
Jianwen W.
  • 3,919
  • 4
  • 18
  • 17
22
votes
5 answers

How to read from files with Files.lines(...).forEach(...)?

I'm currently trying to read lines from a text only file that I have. I found on another stackoverflow(Reading a plain text file in Java) that you can use Files.lines(..).forEach(..) However I can't actually figure out how to use the for each…
user3570058
  • 221
  • 1
  • 2
  • 3
13
votes
4 answers

How to read data line by line from a file using ant script?

In perl we use to read data line by ilne from a file. How to do the same using ant script.
rashok
  • 12,790
  • 16
  • 88
  • 100
7
votes
1 answer

Error: ENOENT: no such file or directory, though the file exists

This is my project structure: This is index.js. var express = require('express'); var router = express.Router(); var fs = require('fs'); var links = require('../models/Links'); var readline = require('linebyline'); var rl =…
Shafayat Alam
  • 702
  • 1
  • 14
  • 32
6
votes
1 answer

Arduino reading SD file line by line C++

I am trying to read a text file "Print1.txt", line by line, from an SD card attached to my Arduino MEGA. So far I have the following code: #include #include int linenumber = 0; const int buffer_size = 54; int bufferposition; File…
Julian Das
  • 1,351
  • 3
  • 11
  • 9
6
votes
2 answers

Is it possible to debug bash scripts line-by-line?

I'll love something like Microsoft Visual Studio's line-by-line debugging in bash, with current variables values and so. Is there any tool or way to do it? set -x and set -v are nice but not perfect.
emi
  • 697
  • 1
  • 6
  • 19
5
votes
2 answers

How to use CSV Helper to read line by line in c#?

So this is the code I am using currently, but I don't specifically want to create my own reader. My problem is that I want to read a full csv file line by line, but the file contents will change from time to time, so it has to be generic. This is…
Kushagra Kasbi
  • 135
  • 2
  • 9
5
votes
3 answers

nodejs read file line by line and get its content at the end

I want to use nodejs to read a file line by line and then when it finishes get the returned result as a json string. I was trying to do like this, but at the end the console.log prints undefined and not the list. I got the list and the end of the…
user1864255
  • 105
  • 2
  • 2
  • 6
5
votes
1 answer

How to read a file line by line and close it afterwards in Scala?

Normally, they will tell you to import scala.io.Source for(line <- Source.fromPath("myfile.txt").getLines()) println(line) which seems to leave the file open. What is a closeable counterpart?
5
votes
1 answer

git smart line and word diff

I'd like to git diff and combine the regular line-by-line diff with git diff --word-diff. The problem with line-by-line diffs is that they're unnecessary if I change one or two words and leave the line mostly intact--the chunking is too coarse. On…
PythonNut
  • 6,182
  • 1
  • 25
  • 41
5
votes
2 answers

How to stage line by line in git gui although "No newline at end of file" warning

I use git gui to select lines for being staged for a commit. This normally works like a charm. I am aware of the option to do the same on the command line. Whenever a file does not initially have a new line at the end of the file git gui recognizes…
JJD
  • 50,076
  • 60
  • 203
  • 339
4
votes
1 answer

ansible read local file to var and then loop read line by line

I would like to create a playbook that reads a local file to a var, Then be able to loop through this var line by line and use the lines in a task. To get the file content i used: file_contents: "{{lookup('file', './myfile.txt')}}" I tried…
Komar Patel
  • 63
  • 1
  • 1
  • 3
4
votes
1 answer

Python string comparison not matching a line read from a file

I have got a text file with keywords in each line like so: foo foo1 ^^^^^^^^^ foo5 foo7 ^^^^^^^^^ is a flag set to break the for loop once reached: keywords = [] with open("keywords.txt") as f: for line in f: if…
almost a beginner
  • 1,622
  • 2
  • 20
  • 41
1
2 3 4 5 6 7 8