Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cat]

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

-1
votes
1answer
27 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
17 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
33 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
20 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
637 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
67 views

combine large arounts of files in 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
22 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
14 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
60 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
55 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
47 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 ...
-3
votes
1answer
112 views

What is the equivalent (programmatically) of cat /dev/something > file.txt [closed]

I'm copying a video from a camera stream using a command cat /dev/video0 > file.mpeg This works perfectly, however I want too break up the file into smaller chunks... So I've been waiting pressing ...
0
votes
1answer
50 views

Pipe file containing list of images to sxiv and reflect changes immediadly

Suppose I have a file images.txt which contains for example image1.jpg image2.jpg image3.jpg Then I pipe the images.txt to sxiv and I want that the thumbnail view reflects the changes immediately. ...
0
votes
1answer
34 views

join all text files in subfolders in ubuntu into a single file

I have many folders/subfolders with text files in them. Is there any way to iterate all of the subfolders and join all the files into a single large file?
0
votes
2answers
73 views

How to let process continue running even after disconnecting ssh?

I have a Linux based router that I’m trying to “control” with a home automation controller. On my automation controller I’m able to utilize a ‘two way strings’ driver to send a string to the Linux ...
0
votes
4answers
97 views

grep and cut text from unstructured file?

From below 3lines I need to grep and cut jar file name only. How to grep jar name from the line and cut from there. Downloading:https://repo.maven.apache.org/maven2/org/springframework/spring-aop/5....
2
votes
2answers
45 views

Need to iterate through subdirectories, concatenating files, with an iterative number

I'm trying to concatenate files from three different subdirectories into one file. The names of the files in each subdirectory are exactly the same. I'd like to use a loop to iterate through the ...
-1
votes
2answers
53 views

How to print the first line which include special word [closed]

Print the first 123 below XXX AAA BCB DDD 123 123 XXX CCC 123 123 MSM 123
1
vote
2answers
20 views

How to echo content into a series of new file generated by cat

I would like to write a loop to generate 22 R scripts with contents generated in echo. What went wrong in this loop that I could not get the 22 files with the corresponding content? I tested echo "i ...
3
votes
1answer
59 views

What does cat of a tar archive show? [closed]

I was doing a penetration testing capture the flag training exercise and found a file called "backup". I checked the file type of "backup" and saw it was gzip compressed. I decompressed it to a file ...
0
votes
1answer
152 views

How to take number of bytes transmitted and received from /net/proc/dev

I want to take the number of bytes transmitted and received from /proc/net/dev in this format: num_ofbytesTransmitted,num_ofbytesReceived. This was my approach: cat /net/proc/dev | grep enp0s3 | cut -...
-3
votes
1answer
66 views

How does `cat` work so that it allows reading a file line as an array element? [duplicate]

In bash, we can read an file into an array, so that each line in the file becomes an element of the array. $ arr=( $(cat myfile) ) I was wonder how cat works so that it allows reading a file line as ...
1
vote
0answers
41 views

How should I output the contents of a file to terminal without using cat? [duplicate]

I've been hearing talk of UUOC, "Useless Use of cat", lately, and it seems like the consensus is that cat should really only be used when concatenating multiple files. This has me wondering, is there ...
0
votes
1answer
18 views

combine files that share a similar characters

I have a folder with hundreds of files. These files are score files for 26 environmental variables across 510 genotype files. For example in the examples below, _s2. is the second environmental ...
2
votes
2answers
89 views

cat is stuck on a specific file

I have a python script that generates a file (cap.pcap). when I execute cat on it, it gets stuck forever (doesn't display anything). I tried to run: The commands file, hd and vi. They work properly. ...
56
votes
1answer
3k views

Change permisions of a file with my cat's help

root@system:~# less myfile -bash: /bin/less: Input/output error The root filesystem is dead. But my cat is still alive (in my memory): root@system:~# cat > /tmp/somefile C^d root@system:~# He's ...
0
votes
2answers
64 views

How to stop cat command from outputting file name if it's piped to another command?

I'm trying to learn regular expressions, and so I created a file with some characters in it. When I use the cat command and pipe it to rgrep command with an argument to filter out text, the resulting ...
1
vote
1answer
81 views

Store a file on server with curl command using post method like scp? [duplicate]

Like this: cat tmp.txt | curl --post domain.com/file-to-store I want to store content of tmp.txt on my machine to server using only terminal. Is it possible?
3
votes
2answers
52 views

How does `cat`'s I/O model differ from that of other utilities?

From the output of stdbuf --help (GNU): Usage: stdbuf OPTION... COMMAND Run COMMAND, with modified buffering operations for its standard streams. ... NOTE: If COMMAND adjusts the buffering of its ...
0
votes
2answers
193 views

make find search in alphabetical order

I am currently using a short find command in order to search a number of directories (and sub-directories) for files ending in "tex" and then catting them into one coherent text. The command that I ...
0
votes
1answer
164 views

Diff outputs “binary files <file1> <file2> differ” but not the usual detail output

I would like to compare two files - "orienv" and "currenv", using the command diff. The way I had created the two files was as follow: Createing the "currenv" file $cat /proc/1/environ >> ...
3
votes
2answers
73 views

Concatenate multiple zipped files, skipping header lines in all but the first file

I have a collection of gzipped files that I want to combine into a single file. They each have identical format. I want to keep the header information from only the first file and skip it in the ...
4
votes
1answer
176 views

How to `touch` and `cat` file named `-` [duplicate]

How do I use GNU touch to update a file called -? How do I use GNU cat to display a file called -? I'm running: % cat --version | head -n1 cat (GNU coreutils) 8.29 % touch --version | head -n1 ...
1
vote
2answers
58 views

Fully show all files in a directory — but with some spacing between them

In CentOS with Bash 3.2.52 I desire to fully-show all files in say current dir: cat * All files' outputs are displaying but they are totally juxtaposed one to another... I lack some cosmetic ...
-1
votes
1answer
464 views

How to read a file using sudo? [closed]

As part of an lab that I am doing titled "sudo", one of the questions is, "What is the password in the secret.txt file?". When I try cat secret.txt I get a permission denied message. When I try sudo ...
5
votes
1answer
699 views

cat and pipe vs. redirection [duplicate]

What's the difference between these two commands? cat /proc/uptime | awk '{print $1}' < /proc/uptime awk '{print $1}' Specifically, how does the second command work? Doesn't the redirection ...
-1
votes
2answers
78 views

How to concatenate only identical file names within two folders to one file?

I have fasta.qz sequence files with identical names, but in two different folders that I need to concatenate (concatenate always those two with identical names only!). The directory structure looks ...
0
votes
1answer
94 views

Ubuntu bash echo “$PASSWORD” | sudo -S WID=$(cat /var/lib/FILE)

/var/lib/FILE root:root 0600 (One line of text) How can I read the /var/lib/FILE into $WID echo "$PASSWORD" | sudo -S WID=$(cat /var/lib/FILE) not working for me.
-1
votes
1answer
1k views

Why does echo <<EOF … EOF not work [duplicate]

Just wondering if anyone can explain why this works: echo `cat <<EOF {"branch":"foo","value":"bar"} EOF` but this doesn't: echo <<EOF {"branch":"foo","value":"bar"} EOF (the second ...
1
vote
1answer
44 views

Copying files based on input list, special characters in file names

This is based on the question here. Problem: I have a .txt file listing file names I want to copy to the folder newfolder in the shell (Mac Terminal). Approach, where filelist.txt contains file ...
-4
votes
1answer
99 views

How to append file2 to file1 without changing their content, then output the result in file3

I have file2 and file1. I want to append file2 to file1 but without changing file1. I want to put the output in anew file file3. If I used cat file2 >> file1 this changes the content of file1.
0
votes
2answers
56 views

answering command automatically - performing cp operation between answers [closed]

The idea is that I want to execute a command, then it asks for a file name to process, and after it is done with processing, it outputs an image with the name prediction.png, it asks for the next ...
-2
votes
1answer
59 views

What is the difference (if any) between “cat input | tee > output” and “tee < input > output”?

I obtained the following: $ time $(tee < infile > outfile) real 0m14.721s user 0m0.094s sys 0m2.629s $ time $(cat infile | tee > outfile) real 0m8.931s user 0m0.123s sys 0m3.168 Is that ...
0
votes
1answer
40 views

using cat command to copy a file's contents to all files under a directory (recursively) [closed]

How could we use cat command to copy a file's contents to all the files under a directory (recursively -I mean each and every file)?
0
votes
2answers
204 views

Why the output of “cat a.out” is some weird text, instead of binary? [duplicate]

We all know "a.out" is file-format used to denote object code(binary) and is abbreviated form of assembler output, then cat a.out should also give us binary but why this doesn't happens? I am ...
1
vote
0answers
19 views

Data loss over ttyACM* in Ubuntu 14.04 whereas success on Ubuntu 16.04 when “cat” command is used [duplicate]

I have a development board which will have 3 ACM interfaces when connected to Ubuntu host and i want to transfer data from Host to Device over ttyACM3. I have followed the following procedure for ...
3
votes
1answer
762 views

cat on big files does not work

I'm trying to concatenate four big files in two. The files *_1P.gz contain the same amount of lines as the corrisponding *_2P.gz. The files A_1P.gz and A_2P.gz both contain 1104507560 lines. The ...
1
vote
1answer
26 views

Why raspbian lite powers off when doing `sudo cat /dev/char/10:130`?

I did on a terminal sudo cat /dev/char/10:130, which in the uevent has name of watchdog, and it outputs a message from the kernel saying that watchdog did not stop !, and after a couple of second it ...
1
vote
0answers
28 views

PING token missed after un-successful Bulk OUT transfer

I'm trying to send a large amount of data(~15 Mb) from Host to Device over ttyACM3. I have used "cat" command for sending the data from host. Host side: cat ./pattern.bin > /dev/ttyACM3 Device ...
2
votes
0answers
141 views

Data loss over ttyACM* when 'cat' command is used for data transfer

I have a development board which will have 3 ACM interfaces when connected to Ubuntu host and i want to transfer data from Host to Device over ttyACM3. I have followed the following procedure for ...