1,525 questions
1
vote
1
answer
113
views
How is it possible that a command chain ending in `cat` prints nothing, but executing `cat again on the same file prints a line?
I run this command sequence:
grep -Fxv "sudo: myname : 1 incorrect password attempt ; TTY=pts/3 ; PWD=/home/myname/workspace ; USER=root ; COMMAND=/usr/bin/pip uninstall ansible" ~/.log-...
2
votes
1
answer
93
views
Bash: Slower to use zcat versus cat+zcat or cat+pv+zcat [closed]
I'm processing some large zipped files and found something interesting that I don't understand where using cat+pv+zcat is faster than cat+zcat which is faster than zcat alone.
For this, I'm using a ...
1
vote
1
answer
65
views
Is there a way to save text in R without it actively implementing \n? [closed]
I'm trying to use a handful of smaller functions to generate input for R Markdown. Some of the input for R Markdown contains calls like:
cat("\\centering\n") or cat(Obj1, Obj2, Obj3, "\...
0
votes
1
answer
64
views
Printing contents of several files after listing them with ls [duplicate]
Although it seems to be a simple task, I am struggling to print the contents of several files that have been filtered in this way:
$ ls *_pattern_*
a_pattern_a
b_pattern_b
c_pattern_c
...
0
votes
2
answers
73
views
How to rename the CSV file based upon the column name inside the file using shell script
Let's assume I have list of CSV files under the folder called /path/RAS, each CSV file is going to carry the information about each customer.
Let's take one customer file as example:
Customer_Name,...
0
votes
1
answer
60
views
copy from text file to other text file , but not owerwiting first 2 lines [duplicate]
I would like to copy the contents of a text file has another text file but do not crush the first 2 lines of the other file, or copy and add the 2 lines to the new file
Exemple:
user1.txt:
Phill
Johne
...
2
votes
2
answers
79
views
How to cat text string and file in bash in way to preserve literal \newpage in output?
I have multiple markdown files that I am trying to concatenate into one markdown file in bash. I can concatenate markdown files and preserve “\newpage” lines, but when trying to add a group title via ...
0
votes
1
answer
57
views
The newline (\n) is not working in END block in bash [duplicate]
I need to define the "\n" in END block as it will be passed to other bash script as an argument.
I have added an empty newline at the begin and at the end. But only the begin empty line (\n) ...
0
votes
0
answers
107
views
Different character using vim, cat and pbcopy
I have a file sample containing the following string when reading it with vim (in german language, converted from html using munpack):
benützt daÿs
if I cat that file, I get the following (correct) ...
0
votes
1
answer
53
views
How to open a split zip archive with more than 99 parts?
I think the problem is that when I concatenate the zip files before unzipping they are not in order because zip only uses one leading zero. For fewer than 100 files, the following works.
cat myzip.z* &...
0
votes
2
answers
225
views
cat and curl large JSON value from gitlab ci
There are many questions on how to post JSON via curl. And I am able to send one word as json but not the whole text.
My requirement is to comment a merge request when one job fail in our GitLab CI.
# ...
0
votes
0
answers
71
views
SwiftUI How can I get the correct font size for CATextLayer
I am using SWiftUI and have a video editing application . A person selects a video and we display it along with the date the video was taken . The initial overlay is size 14 and if the person saves ...
0
votes
1
answer
431
views
exec: "cat": executable file not found in $PATH: unknown.'
Failed to run image docker.io/hadolint/hadolint:v2.8.0 . Error: docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: run c ...
1
vote
2
answers
249
views
Display a blowfish encrypted file without vi(m)
I have a file I have encrypted in vi (vi -x myfile) with blowfish2 encryption (:setlocal cm=blowfish2). I can supply the password and edit the file with no problem.
If all I want to do is view the ...
0
votes
1
answer
680
views
How to read an open file through a file descriptor from proc?
I'm trying to learn how to work with proc and file descriptors. I want to start a process that opens a file, read the same file in parallel through a file descriptor from proc.
I tried to do this:
#!/...
0
votes
0
answers
19
views
Trying to categorize some columns and exclude others. Getting this error Cannot perform 'ror_' with a dtyped [object] array and scalar of type [bool]
I would like to exclude ratings column and correctYear column from getting categorized. I would like to categorize every other object type field but leave out these two because they are numeric values....
-1
votes
1
answer
81
views
If I execute a task from terminal it works, but within a script it don't...Why? [closed]
Tried every step from terminal, one by one. And they work, but when I execute
cat $dj_name | grep -Eo "(https)://[a-zA-Z0-9./?=_%:-]*.mp3*" | sort -u > $dj_name-tracks
in a script, the ...
-3
votes
1
answer
103
views
How can i use any bash command in bash function
I am trying to use ls , cat etc commands inside a bash function
Report()
{
ls $1 | sort -u
}
Report()
I am getting ls: command not found error when I run the function
Is it not possible to use ...
1
vote
1
answer
65
views
rewrite shell script so that cat does not evade the check
Currently, I use
#!/bin/sh
while [ -e "${XDG_RUNTIME_DIR}" ]; do cat ${FIFO} ; done | my_program
to create a fifo for my_program, which reads from stdin.
The problem is that cat breaks out ...
0
votes
1
answer
34
views
How do I loop through files and combine them based on a species designation? - Bash
I'm trying to merge fastq.gz files together based on species, and I'm trying to figure out how to do that without explicitly naming the species I'm using so that I can use the same bash script for ...
0
votes
1
answer
113
views
multi-line json files to ndjson
Is there a linux/mac command to copy multiple multi-line json files to a single ndjson file?
item1.json
{
"type": "Feature",
"version": "1.0.0",
"id&...
0
votes
1
answer
396
views
How to print ENV VAR name to file, NOT VALUE from linux cli
I have this:
cat > ~/add_api_txt_hook.sh <<EOF
#!/bin/bash
...
echo $MY_ENV_VAR
EOF
MY_ENV_VAR is not set when this file is made. So it makes it "" in the file.
I want the file ...
-1
votes
1
answer
122
views
How to subtitute the cat command in a bash file?
I'm working in testing my smt model using different solvers. In this moment I have the file .smt2 which contains the instruction of a model converted in smtlib. I have created a file .sh which ...
0
votes
1
answer
98
views
How to store multiple commands in a bash variable (similar to cat otherscript.sh) [duplicate]
For work I'm needing to connect to test nodes and establish a vnc connection so you can see the desktop remotely. It's a manual process with a bunch of commands that need to be executed in order. ...
0
votes
1
answer
38
views
chnaging a specific column in a specific row with for loop
I have a file with following content
### beginning of executable commands
### load the necessary module files
module load GCC/11.3.0 OpenMPI/4.1.4 CP2K/9.1
### your program goes here (a.out is an ...
0
votes
0
answers
35
views
Escaping a dollar sign in bash -c cat command [duplicate]
This example not work in my case.
This example is about bash -c but there is no cat example.
How Escaping a dollar sign using bash -c ?
This is my code. It is not work correct. I get empty file. But I ...
-2
votes
3
answers
140
views
Merge files, reverse order and replace text
I have a data file (*.js) per day with the following content:
m[mi++]="26.03.23 23:55:00|0;0;0;2720;0;0;0|488;0;3270"
m[mi++]="26.03.23 23:50:00|0;0;0;2720;0;0;0|1360;0;3220"
m[mi+...
1
vote
1
answer
767
views
How to make cat command to view file content with syntax highlights in terminal
In the following screenshot, on executing the cat command it display the horizontal line then file info with name and then file content.
Is this feature from cat or any external lib?
I have found one ...
0
votes
1
answer
61
views
Is cat files slower if run through bash file and screen?
I am doing
cat this_files_* > output.txt # reads approx 20 mio. files and cats them into output.txt
When doing it through command-line last week on another dataset, it was significantly faster ...
-1
votes
1
answer
100
views
bash script that receives any sequence of nucleotides and print all positions of the T nucleotides
I need to write a bash script that receives any sequence of nucleotides and print all positions of the T nucleotides.
I did the following:
'vim nucleotide.sh'
inside the script
#!/bin/bash
$@
cat $@ | ...
1
vote
6
answers
212
views
Need to iterate over all the items in my current directory and print their names along with other operations
I need to create a loop that will iterate over all the items in my current directory to check whether this item is file, then print the name of the file and the 1st 10 lines of the file.
I did the ...
0
votes
2
answers
92
views
How do I get and format the contents of a bunch of text files (md5sums) in Linux?
I have a bunch of md5 files, which have a hash and a path/filename. I want to output the hash and filename, but not the path.
Example file contents:
d7b7494a0602d91b391848dfaebec7ac /home/develop/...
0
votes
1
answer
94
views
Python web crawler download pic , pic format not be supported
I was using same code to try to get cat's photo , the picture address is not different.
But why does one can get picture , other one can't be got?
#pic download successfully.
import requests
...
0
votes
1
answer
80
views
cat: 'd'$'\303''ata.txt': No such file or directory
I'm a newbie learning docker and have followed the instructions on docker homepage.
I'm following this tutorial at this link.
After, I have dragged the image to docker desktop completed as shown below:...
-3
votes
1
answer
814
views
Why does cat < /dev/ttyS0 send output to ttyS0? [closed]
When I use cat < /dev/ttyS0 and data is received, it doesn't display on the terminal that I typed the command into but instead gets sent back to to ttyS0 where it came from. How can I make it not ...
1
vote
1
answer
395
views
Why pipes not working for cat | cat | ls?
I really need help and any suggestions will be very welcomed. Me and a mate have coded a mini version of the Shell and I did parsing and executing parts. All is working properly except for some cases ...
1
vote
1
answer
451
views
Why I get empty file after sed -e?
given the following file file:
my name is: @NAME@
I ran this script:
name="Alin"
full_file="$(mktemp)"
cat file | \
sed -e "s:@NAME@:${name}:g" | \
>> &...
0
votes
4
answers
117
views
Bash script to merge two files if they start with the same 4 characters
When I tested the code on a directory that only had 100 files everything executed quickly. But the actual directory has 20k files and everything slows to a halt. Example files are 0001.txt 0001.doc ...
1
vote
4
answers
2k
views
How to search a file in linux containing a particular string and then printing all contents of that file?
Requirement : Searching a file in linux containing a string and then printing all contents of that file.
Approach I used: grep -ri "<string_name>" | cut -d : -f1
Using this command I ...
-1
votes
1
answer
62
views
How to split a file into lines using foreach in linux? [closed]
File.txt has numerous lines with paths to different files
I want each line of File.txt to become an argument to sed command
Ex :
File.txt has following lines
dir1/sub1/a.txt
dir2/sub2/b.txt
dir3/sub3/...
1
vote
1
answer
207
views
How to create repaginating sequences for booklet printing as output for pdftk?
I'm creating a workflow for booklet printing with 2 pages on an open spread:
Use R to create the page sequence
Use pdftk to repaginate the pdf
Use lp to print the 2-up booklet
I've written a loop ...
1
vote
2
answers
588
views
Get multiple file contents to one Ansible variable
On Ubuntu 18 server in directory /home/adminuser/keys are 5 files that contain key parts:
/home/adminuser/key/
|- unseal_key_0
|- unseal_key_1
|- unseal_key_2
|- unseal_key_3
|- unseal_key_4
...
1
vote
1
answer
84
views
Should I handle multiple instances of cin / stdin?
Below is a little program in C++ which is supposed to act as the cat linux binutil: it gets one or several inputs as detailed in the command line arguments (possibly specifying stdin via '-') and copy ...
0
votes
2
answers
58
views
grep a word from a list of file as a result of grep before
I have a command to grep a file with fullpath that contain a "TypeId: 0", here is the command
grep -rnw /home/username/app/data/store/0/part/.mv -e "TypeId: 0" | awk -F ":&...
1
vote
1
answer
254
views
In R, how do I save the dataframe which is one of the outputs from a function which uses print() and cat()?
I am using a summary() function from an R package. It prints out multiple results by using cat() and print() functions interweavingly (I checked its source code by getAnywhere()). It uses cat() to ...
0
votes
1
answer
2k
views
How use cat and grep with gsutil and filter with a subdirectory name?
Currently, for getting a string (here: 123456789) into some files in all my buckets I do the following:
gsutil cat -h gs://AAAA/** | grep '123456789' > 20221109.txt
And I get the name of my path ...
0
votes
1
answer
171
views
Copy Files Contained in a Text File (MacOS)
I have a text file containing .M4B filenames (including source path). The file names contain spaces and quotes like:
/file/source/Ender's Game.m4b
/file/source/Ender's Shadow.m4b
/file/source/Speaker ...
0
votes
0
answers
22
views
Escaping the ${APACHE_LOG_DIR} variable in the cat command of a bash script [duplicate]
I'm coding a BASH script to automatically configure virtual hosts of an apache server.
To create the virtual host configuration file I use the cat command. The problem is that I don't know how to ...
0
votes
2
answers
162
views
Gnuplot: assign the resulted grep in log file to a variable
my logfile is as:
********************************************************************
maximum disp: 3.2580e-05, at node: 3, of total: 6
maximum disp: 4.2876e-05, at node: 6, of total: 6
*************...
1
vote
2
answers
191
views
Why a string starting with 'cat....' outputs with a different color in Programiz?
I can't figure out why when I print a string starting with 'cat..' (like category, cathedral, catch, ...) in the Programiz Online Python Compiler it appears in green (or gray and italic in dark mode) ...