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.

0
votes
2answers
29 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?
-1
votes
0answers
27 views

Cat *.ext not combining all video files inside folder

I would like to combine all video files without having to specify each file individually. Each .MP4 file is 4GB. cat *.MP4 > 11.04.2019_Market_Road.MP4 > File Size 26.5GB, only plays 8 ...
5
votes
3answers
512 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
496 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
42 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
37 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
1k 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
221 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
60 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
29 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
434 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
61 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
67 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
44 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
21 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
641 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
81 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
23 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
114 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
56 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
49 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
124 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
73 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
36 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
85 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
154 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
50 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
56 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
25 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
75 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
227 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
88 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
42 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
140 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
76 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
149 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
58 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
338 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
245 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
128 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
220 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
61 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
682 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
937 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
144 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
139 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.