2,262 questions
3
votes
3
answers
234
views
Performance issues with reading lines from *standard-input*
I need to process 100 Gigabytes of logs in a weird format, then do some analysis on the results.
Initial parts of parsing and CLI done, tried on some test data with 1 GB and it took around a minute. I ...
1
vote
1
answer
133
views
php's readline() method adding weird line breaks when executed via shell?
So I have this really weird issue where I have the following dummy.php script:
<?php
declare(strict_types=1);
$prompt = "Hello there!".
PHP_EOL . "What do you want to know?"...
1
vote
3
answers
145
views
Huge time difference when reading a file inside class
Any suggestions where this huge time difference results from when reading the same large text file by the same loop from inside a class in Python.
import timeit
fn = "some-large-file.txt"
...
72
votes
20
answers
111k
views
TAB completion does not work in Jupyter Notebook but fine in iPython terminal
TAB completion works fine in iPython terminal, but not in Firefox browser.
So far I had tried but failed,
1). run a command $ sudo easy_install readline,
then the .egg file was wrote in /usr/...
0
votes
3
answers
95
views
Using Vim macros on the command line
I am using Vim bindings in bash (set -o vi) and I wanted to know if it is possible to use and save Vim macros on the command line. For instance, I would like to save a macro like this:
let @q = "...
0
votes
3
answers
132
views
Is this the correct way to move to the beginning of each line in a text file using seek()?
from sys import argv
script, input_file = argv
hello = open(input_file)
read1 = hello.readline()
print("Line1: ", read1, end = "")
line1 = len(read1) + 1
print(line1)
read2 = ...
2
votes
2
answers
135
views
Linenoise C api - any way to preload the buffer to set a default line
I'm using linenoise with a c command line style program. The standard way of using linenoise is to do a simple
char* line;
line = linenoise("prompt: ");
// Use the line in the app
free(...
1
vote
0
answers
118
views
gdb backspace deletes whole line?
I just hate it so much when small things that were working since forever suddenly break.
I use MINGW64 bash in Windows Terminal in Windows 10. When I run gdb-multiarch, inside it, suddenly Backspace ...
61
votes
2
answers
41k
views
How can I delete a whole word after the cursor in a Bash-like command-line tool? [duplicate]
In command-line applications, such as the Bash shell that implements readline-like line editing capabilities, there is a key binding for deleting a whole word before the cursor, which is by default ...
148
votes
5
answers
63k
views
How do I change bash history completion to complete what's already on the line?
I found a command a couple of months ago that made my bash history auto-complete on what's already on the line when pressing the up arrow:
$ vim fi
Press ↑
$ vim file.py
I'd like to set this up on ...
0
votes
0
answers
95
views
libreadline.so.8: undefined symbol: UP in ubuntu 20 lts
same problem as for libreadline.so.7 in fedora. It seems that readline configure is catastrophic assuming that readline.so is already present in /usr/lib
1
vote
1
answer
140
views
Is it possible to modify the entire line and display autocompletion suggestions in a single go in bash?
Bash provides facilities to modify an entire line and change the position of the cursor with commands bound to bind -x through READLINE_LINE and READLINE_POINT variables:
$ cat test.sh
#!/bin/bash
...
0
votes
1
answer
604
views
Renci SSH.NET hangs on simple command and response
Using Renci SSH.NET, I am trying to send a simple command to an ethernet switch over ssh, and then to read the response back from the switch. I can connect to the switch but it just hangs when I call ...
2
votes
2
answers
97
views
How can I properly reprint a readline prompt on SIGINT?
I have the following signal handler established:
void sig_handler(int sig)
{
if (sig == SIGINT)
{
printf("\n");
rl_on_new_line();
rl_replace_line("&...
88
votes
7
answers
129k
views
Best method for reading newline delimited files and discarding the newlines?
I am trying to determine the best way to handle getting rid of newlines when reading in newline delimited files in Python.
What I've come up with is the following code, include throwaway code to test.
...
0
votes
1
answer
74
views
Scanner.readLine() with custom line delimeter
I have a string that needs to be read using the Scanner class from the beginning to the \n character. The problem is that the source stream in my case may contain the character \u2028. I know that the ...
20
votes
11
answers
55k
views
How to take two consecutive input with the readline module of node.js?
I am creating a program to take input of two numbers from the command line and then showing there sum in node.js. I am using readline module to take stdin. Below is my code.
const readline = require('...
36
votes
9
answers
12k
views
editline/history.h and editline/readline.h not found/working on macOS when trying to compile with developer tools installed already
I am working on this tutorial on building your own LISP (http://www.buildyourownlisp.com/chapter4_interactive_prompt) and for some reason when I try to compile I get this:
REPL.c:4:10: fatal error: '...
1
vote
4
answers
179
views
text file -- how to sort adjacent lines that have the same level of indentation
UPDATE: The root problem has been solved by fixing a number of Sequelize migrations that always run before mysqldump is called, as discussed in the comments that are below the article that is linked ...
54
votes
2
answers
16k
views
Python REPL tab completion on MacOS
Before upgrading to lion, I had tab complete working in a python shell via terminal. Following these instructions, it was possible to have tab complete working.
Since upgrading to Lion, I am now ...
50
votes
6
answers
15k
views
Return to readline version 6.x in Homebrew to fix Postgresql?
I'm no Homebrew expert but I think it has "upgraded" me from readline version 6.x to 7.0 sometime after 9/15/16:
eat@eric-macbook:Homebrew$ brew info readline
readline: stable 7.0 (bottled) [keg-only]...
9
votes
2
answers
53k
views
Difference in read(), readline() and readlines() in Python
I was looking on a web of Python the commands mentioned in title and their difference; however, I have not satisfied with a complete basic understanding of these commands.
Suppose my file has only the ...
0
votes
0
answers
121
views
How can I pass input to an R script being run with nohup?
I am currently running R code on a server in the background with nohup in the following way:
nohup R --no-save < Rscriptname.R &> out &
I need to make some small changes to the script ...
1
vote
1
answer
65
views
How do I catch return characters when using character-at-a-time BASH builtin read with if or a case statement?
I stumbled across what should be something simple that's turned out to be a brain-teaser. As a not fully accomplished BASH programmer, I naively thought I could read in characters from an interactive ...
39
votes
5
answers
476k
views
Python Serial: How to use the read or readline function to read more than 1 character at a time
I'm having trouble to read more than one character using my program, I can't seem to figure out what went wrong with my program.
import serial
ser = serial.Serial(
port='COM5',\
baudrate=...