Questions tagged [cat]

cat is a standard Unix utility used for concatenating files or printing specific file on the standard output.

Filter by
Sorted by
Tagged with
-2
votes
0answers
15 views

Free UNIX and Linux Computer-Based Teaching Software for Review [on hold]

I recently released some software that teaches the basics of the UNIX command system and I'm inviting comments. (Linux and the Mac operating system are both versions of UNIX so everything I say here ...
0
votes
1answer
29 views

How to recursively find file, concatenate into one file and simultaneously delete the original file

As I understand it, I could use find . -name '*.txt' -exec cat {} \; > all.txt to concatenate all the text files in a directory, recursively throughout sub-directories, into a file called all....
0
votes
1answer
54 views

store `cat` output as a placeholder

I am using a program called minimap for aligning reads to a reference genome (computational biology problem). This program requires as input two files as positional arguments: first a reference in ....
0
votes
2answers
91 views

How can i count lines in file

I need to count how many times different IP's were in the file. I'm using this to open file because i don't have grep rights to do it only with grep My Rights User lotarc may run the following ...
0
votes
1answer
33 views

Cannot cat .pem file inline as -i option to ssh

I am getting this error: Warning: Identity file /dev/fd/63 not accessible: Bad file descriptor. when running this command: ssh -Y 'root@ec2-54-xxx-94-xxx.us-west-2.compute.amazonaws.com' -i <(...
0
votes
0answers
29 views

Non blocking cat (Read as much data as you can from stdin and hold it in RAM until a write-blocking stdout becomes available)

I have a program (which may or may not be aplay) that accepts its stdin rather slowly. Programs that write to said stdin (such as via a pipe) tend to block on writes a lot. Needing to wait on input ...
0
votes
3answers
73 views

What happens on ssh file transfer when disconnects?

Suppose, I have some file with path %p which I need to gzip on the fly and send to a remote server and I'm not allowed to use rsync and similar mirroring tools. I do the following: gzip -c -9 %p | ...
0
votes
0answers
24 views

how to combine 229 files into 1 file in filename order [duplicate]

I have 229 files. 1.csv 2.csv 3.csv to 229.csv I want them merged according to their filename. so 1.csv then 2.csv then 3.csv and so on. I tried cat *.csv >merged.csv but the merged.csv file has ...
2
votes
1answer
316 views

How to save command result in variable in Jenkins shell build step

I want to run this script inside my Jenkins job. My goal is to save the cat output into a variable so that I can use it somewhere else. #!/bin/bash ssh myserver.com <<EOF echo "Start." CYCLE=$...
1
vote
2answers
41 views

output mixed alphanumeric input with grep,pipe and cat

I have a mixed wordlist as an input: azert12345 a1z2e3r4t5 a1z2e3r455 The command line I have tried to execute: cat file.txt | grep -E "[[:digit:]]{5}" --color What do I want to accomplish: Print ...
4
votes
2answers
79 views

Get city location from IP addresses inside a file

What a i need is to find the city associated with each IP address, I've stored them inside a file. For example, the file's content is: 99.203.11.34 99.203.11.37 99.203.11.47 99.203.11.51 99.203.11....
0
votes
2answers
35 views

how to display double quotes

bash version: bash-5.0.7 double quotes disappeared [root@cander ~]# cat test.sh #!/bin/bash cat > test.conf << EOF AA=${one:-["one","two"]} EOF [root@cander ~]# sh test.sh [root@cander ~]#...
-1
votes
2answers
79 views

Display contents of the file searched by grep or find command [closed]

I have lots of directories in a certain directory and I am trying to find a specific file present in there. I used grep command recursively and was able to locate the file being present in there, but ...
0
votes
0answers
18 views

How do I monitor a Socat mounted COM Port device for a specific Char Delimiter?

I have a code like the following: cat -v -e /dev/tty03 | grep --line-buffered '^F' | while read do echo "Line Found" done How can I setup a timeout for the above While Loop. I want the "while" ...
0
votes
1answer
31 views

Can't seem to concatenate multiple files in different directories

I'm trying to concatenate multiple files together that are in different directories using the following command: ~$ find . -name ‘*.text’ -exec cat {} >> combined.text \; However it doesn't ...
0
votes
1answer
19 views

replace/remove text (sed) by a file

I want to replace/remove text all files by a file. $ echo "_uU_%UHY%^GSSD$%GWRW$T#wf4werwefF$fW#$wfdd%6blahblahblah" > pattern.txt $ sudo grep -rl "_uU" . | xargs sed -ie s/$(cat pattern.txt)//g ...
1
vote
1answer
130 views

How to cat named pipe without waiting

If there is nothing in a named pipe and I do: cat my_named_pipe it will wait until data arrives. Is there a flag I can use to exit immediately if there is no data to be read? Or perhaps a command ...
2
votes
1answer
101 views

`cat -v` for non-printing non-ascii UTF characters

cat has a -v option which converts non-printing characters to their caret notation (which is useful if we don't want the terminal to interpret the control characters literally in cat output). But ...
2
votes
1answer
68 views

Pass variable to cat [duplicate]

I have only one variable in bash script ${PHP_V} and trying to pass in nginx config file like: cat <<'EOF' > /etc/nginx/sites-available/default server { listen 80 default_server; ...
0
votes
1answer
343 views

Display line number in head and tail command like `cat -n`

cat without -n user@linux:~$ cat /etc/sysctl.conf | head -4 # # /etc/sysctl.conf - Configuration file for setting system variables # See /etc/sysctl.d/ for additional system variables. # See sysctl....
0
votes
1answer
34 views

I am not able to update a variable through sed command

I have assigned two variables but not able to update x=$(cat /scratch/env.properties | grep ConfigPath) y=$(ConfigPath=/scratch/a/b) then sed to replace ConfigPath in env.properties sed 's/$x/$y/' ...
5
votes
2answers
86 views

What determines whether backspaces show up in a file created with cat?

I just noticed that I've seen different behavior across different systems when creating a quick test file (e.g. with sample input) via cat and redirection. Here are the steps to see what I'm talking ...
1
vote
2answers
207 views

find n most frequent words in txt file using the terminal but with the cat, “grep .” and tr -d “/r” commands

I would like to find n most common words in a text file but with the following conditions: cat to get the file. grep . to get the words. tr -d '/r' to get rid of new lines. I've managed to get ...
0
votes
3answers
209 views

create single string argument using heredoc or other technique

I am trying to execute a script on remote servers, passing the script as the last argument ntrs exec-all-ubuntu --exec `cat << 'EOF' echo "$(pwd)" echo "$foobar" EOF` The problem is that ...
0
votes
2answers
54 views

How to delete string other than pattern?

I have a m3u file as below. I want to delete all strings except the pattern and next first line. or save the pattern and the next first line as another file. Patterns group-title="TR ULUSAL" , group-...
0
votes
1answer
131 views

echo strings but extra question mark was added to the output

Strange "?" got added to the filename output. SCRIPTS="/path_to_script/" SUMMER=`cat /path_to_file/summer.txt` for i in ${SUMMER}; do cat <<- EOF > $SCRIPTS/20190430_$(echo ${i})_step4.r #...
2
votes
1answer
34 views

How I can read content of the ssh key file using a path read from a file?

I need to read content of the ssh key using the given path resides in a file like following: my ssh private key is: ~/.ssh/firstname.lastname When I call cat ~/.ssh/firstname.lastname in terminal on ...
1
vote
1answer
74 views

`cat` behaves strangely on a mounted virtio directory

When I'm in a mounted directory (9p) on my gentoo-guest and do the following: TMPDIR='./foo' # The directory './foo' exists and the name 'TMPDIR' is important cat <<EOF hello world EOF I get ...
0
votes
2answers
40 views

How to extract lines knowing start and end lines

I have a file with 1 million lines. I want to extract lines from line 10001 to 500000 How to do this?
6
votes
3answers
533 views

How to display lines in a file like ls displays files in a directory? [duplicate]

I have a long file with short lines (one word) f that I would like to inspect. It would fit on the screen if it wasn't for the newlines. If the data was already arranged in columns I could just do ...
1
vote
4answers
1k views

Why use cat to view a file? [closed]

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 ...
0
votes
1answer
74 views

Why do cat and more wrap lines differently?

It seems that more adds line breaks, whereas cat does not. As a result cat results will change to fit the terminal window if I resize the window, whereas more results stay put with the line breaks ...
0
votes
1answer
80 views

“nohup cat” — write the complete content to the log file rather to concatenate file

I used the below command nohup cat fastp-filtered/OZBenth*_R1.fastp.fq.gz > fastp-filtered-merged4racon/merge_R1.fq.gz > merge_R1.out.log 2>&1 & but unfortunately, the output went ...
7
votes
2answers
2k views

cat shows nothing

My team is working on a CI environment. A ko file, named x.ko, is always generated from the CI environment at a regular time everyday and its type is ELF 64-bit LSB relocatable. Today, I found that ...
2
votes
4answers
501 views

How to copy the rest of lines of a file to another file [duplicate]

I have the string xyz which is a line in file1.txt, I want to copy all the lines after xyz in file1.txt to a new file file2.txt. How can I achieve this? I know about cat command. But how to specify ...
0
votes
2answers
188 views

Is there a quickest way to count lines in file which is of 4TB in linux?

Actually I have 4 TB of Txt file as Exported from Teradata records and I want to know How many records are there in that file.
1
vote
0answers
60 views

Getting awk value and outputting to a file [duplicate]

I need to get a value from a log file which I am getting using awk at the moment. I can get the number printing on the console but when I try to put that value into a new file nothing happens. Here is ...
3
votes
3answers
745 views

insert EOF statement before the last line of file

I want to insert this cat <<EOF >> /etc/security/limits.conf * soft nproc 65535 * hard nproc 65535 * soft nofile 65535 * hard ...
0
votes
1answer
133 views

cat shows file contents, gedit and vim show blank file

I was planning on building a current logging device with an Arduino, and tried starting off with the basic SD-card write example from the Arduino IDE sketchbook. The Serial console showed no errors, ...
-1
votes
1answer
115 views

Can't see the contents of a data file in terminal

I have downloaded a number of input files from the NASDAQ website (for example ftp://emi.nasdaq.com/ITCH/01302018.NASDAQ_ITCH50.gz) After decompressing (I double click on a Mac) I can't see the file ...
0
votes
0answers
22 views

Different behaviours of sudo [duplicate]

I created a file with sudo like this: sudo touch abc.txt Which understandably set the owner to root. Now when I try to edit the file via vi using sudo, it works: sudo vi abc.txt #works But when I ...
0
votes
1answer
119 views

How to merge files in Linux while deleting the source files

I have 2 large files (of about 27 GB each), which I need to merge. They were originally one whole ZIP file, but I split it. The problem with the cat command is that it creates a new file which has the ...
0
votes
2answers
28 views

cat: append a text file in another folder as Dolphin action

How can I append an md-file to another md-file in a subfolder as Dolphin action? I tried cat %U >> subfolder-name/%u, but I get this error message: cannot create subfolder-name//path/to/md-...
2
votes
3answers
647 views

Why can I not access a file named `-` when quoting? [duplicate]

I have a file called -. I want to display its contents. One way is to do cat ./- since cat - reads from standard input. However, why are cat "-" and cat '-' also interpreted by the shell as cat -?
2
votes
4answers
104 views

Combine large amounts of files inside a directory

I have a large amount of files within a single directory, currently 10,804 files. the amount of files can float between 5 and 100,000. I am looking for a way to combine every 250 separate files into ...
0
votes
1answer
28 views

Merge Lines that start with special Character into new File

the following Situation: I have about 2000 Files that are named like "dens_Run0_set0.#" where # is some Number and they are filled like this 1 0 1.000000e-01 6.3043370127282594e-01 -9....
0
votes
0answers
17 views

Replace the part of lines in multiple files matching a pattern with lines from another file in order [duplicate]

I want to replace the part of lines matching a pattern from multiple files from the lines in order from another file, i have up to 500 txt files, with structure: test1.txt, test2.txt, test3.txt... ...
1
vote
1answer
484 views

Removing control M characters from a given file and to remove newline character if it is the only character in the entire file

We have a file named as abc.txt and its a empty file. Due to some junk or control M characters, the file size is populated as 5 byte file. In order to have clean file we are using dos2unix command to ...
1
vote
2answers
65 views

navigating forward in more pager using f

It is given in the man page of more that f is used to skip forward k screenful of text(default to 1).I saved a very long file using cat and used more to show it on the screen page by page but when i ...
0
votes
2answers
57 views

How to use bash cat * to wrap? [duplicate]

ls /proc/ 1 10984 11246 131 144 167 2099 31788 4805 5375 6762 7594 8111 8722 consoles 10 10993 11247 1314 14400 168 21 32 4807 5379 6771 76 8112 ...