Hot answers tagged

11 votes
Accepted

What are the metrics that `file <file>` uses to determine the type of a text-like file?

Most file type detection in file is based on “magic” values, described in a large set of files; TeX files have their own set of detection recipes. CSV files however are handled differently, with a ...
Stephen Kitt's user avatar
9 votes
Accepted

Copy a evenly spaced subset of files

Note that brace expansion is not globbing, it will expand regardless of whether words in the result refer to actual files. If you want to copy only those of those files that actually exist, you ...
Stéphane Chazelas's user avatar
7 votes

Copy a evenly spaced subset of files

Brace expansion in bash supports steps in the format {<start>..<end>..<step>}: $ echo file{0..100..19}.txt file0.txt file19.txt file38.txt file57.txt file76.txt file95.txt Though it ...
muru's user avatar
  • 71.2k
2 votes

Copy a evenly spaced subset of files

There isn't a useful pattern in the set of file names (numbers) you've provided, so the simplest "one liner" you can hope for is: cp file0.txt file19.txt file39.txt file59.txt file79.txt ...
Chris Davies's user avatar
1 vote

Checking if there's a file with a particular name in a lot of directories

In zsh: if ()(($#)) **/*.bam(ND.Y1)); then print There is at least one regular file in here whose name ends in .bam fi directories_without_bam=( **/*(ND/^e['()(($#)) $REPLY/*.bam(ND.Y1)']) ) if (...
Stéphane Chazelas's user avatar
1 vote

Why creating files in /dev/shm is not faster than creating files in /tmp?

I asked myself the same question. Is /dev/shm/ faster than my home directory or /tmp? I distrust the bash-loop test. Someone else suggested that this should be done in C/C++. This is my test: We have ...
Eddy-Python's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible