Questions tagged [line]
The line tag has no summary.
31 questions
-2
votes
2
answers
87
views
Perl RegEx one-liner that outputs all matches from one line of STDIN
Here is a silly example that effectively illustrates what I need:
echo '"this text", " ", "is in speech marks"' | perl -lne 'print "$1" if /"(.*?)"/'
...
0
votes
1
answer
756
views
Deleting a hidden file with linux command
I tried using rm -rf .* command to remove a hidden file and I am met with this error.
rm: refusing to remove '.' or '..' directory: skipping '.'
rm: refusing to remove '.' or '..' directory: skipping '...
2
votes
1
answer
90
views
Extract content between first one match and first different match across one or multiple lines
Let's say I want to get the text between the first match of "start_" and the first of "_end", no matter it it's across same or multiple lines. Don't include the matches.
Example ...
5
votes
3
answers
1k
views
Help with Find command: Find files or folders that start with a space (ore more than one space) on linux
How do I do a search for any of the following:
Find folders that start with a space on linux and then remove any starting spaces so the folder can start with a letter or a number?
Find FILES that ...
0
votes
1
answer
83
views
How to search an argument/flag/option in man with a line break?
In man argument/flag/option chapters generally include a line break, as with:
-s
silent
How could I find only the -s which includes a line break after it, just as in the above example?
The ...
0
votes
0
answers
128
views
FOLD not working on very long lines
I have a fold command as below to split a file with very long line into multiple lines. It works if the file is small. But if the length of the file is too long, it stops adding new line character ...
2
votes
1
answer
2k
views
Showing line numbers by default in ed
In the ex editor, one can show line numbers by default by adding this line to a .exrc file:
set number
Is there a way to have ed start with line numbers showing by default, when lines are invoked?
2
votes
2
answers
3k
views
In a file to find and replace/change multiple strings in a line with shell script
I am new to shell scripting
What I have is a log file, each line begins like the below entry,
[2021.04.27.17:03:43.813]: ERROR -
[2021.04.27.17:04:36.790]: SUCCESS -
The desired output to a new file ...
0
votes
1
answer
524
views
PureOS Command Line Window
I'm new to PureOS and I've been looking for a way to open a command line window without any luck. How do I open a console/command line window in PureOS?
0
votes
0
answers
241
views
Gnuplot connect points when no value
I have below example,
1|5
2|8
3|1
6|8
7|5
8|10
With below code the chart connects between 3 and 6 x data is there a way to plot zero values between 3 and 6 x data,
gnuplot << EOT
set ...
1
vote
1
answer
53
views
merge x and x + n lines
I am writing a script which returns 15 lines of titles and 15 lines of URLs.
title 1
title 2
title 3
*snip*
title 14
title 15
http://example.com/query?1
http://example.com/query?2
http://example.com/...
0
votes
2
answers
1k
views
Is a text file bigger on Windows than on Linux because of carriage return?
Let's say I have the same ASCII text file on Linux and Windows:
one
two
three
The two files will have \n and \r\n respectively as EOL character on the two OSes.
Does this mean that the file on Linux ...
1
vote
4
answers
548
views
How do I print line numbers but reset line counter at empty line?
I have a file.txt containing:
this is the first
second line
not last line
fourth but first
second in list
seventh in file
seventh with nl
Normally I would just cat and pipe | it into nl like so:
$&...
0
votes
2
answers
223
views
using $ arguments on the command line and providing values for them at the end
rather than write scripts for every single process I need to do, I like to just save commands in a text file and copy and paste them on the command line. Of course, some of the specifics of the ...
2
votes
4
answers
5k
views
Read file line by line with awk to replace characters in certain line numbers
I have got this script here. It is supposed to run the loop by reading the file LineNumbers.file line by line (each contains a line number) and then accordingly replacing 0/0 with ./. in the ...