Skip to main content

All Questions

Tagged with or
1 vote
1 answer
60 views

Case-insensitive pattern replacement in Zsh parameter expansion

Please look at this pattern replacement in parameter expansion: % zsh -c 'echo ${0/%.jpg/.jpeg}' toto.jpg toto.jpeg Replacement does not occur here: % zsh -c 'echo ${0/%.jpg/.jpeg}' toto.JPG toto.JPG ...
Pierre ALBARÈDE's user avatar
4 votes
3 answers
524 views

In Grep, how can I `grep -r --exclude build/lib/**/*.py`

I setup a directory structure as follows: mkdir -p /tmp/test/build/lib/aaa/ cd /tmp/test mkdir rar echo "Hello" > foo.py echo "Hello" > bar.py echo "Hello" > ...
90ueiomtn's user avatar
3 votes
3 answers
882 views

I need a standard way of expressing as a wildcard expression a set of subdirectories of a top level directory all with the same name

I don't know if such a standard exists, but I thought I'd ask the question. Is there a way to express the following as a wildcard expression: all subdirectories named 'process' residing under a top ...
Steve Cohen's user avatar
0 votes
0 answers
31 views

Wildcard not expanding. sudo to blame? [duplicate]

RHEL 8. $ alias suip alias suip='sudo -iu postgres' If I specify the complete filename, the ls command works as expected: suip ls ~postgres/logs/pgbackrest_2025-04-30_01:00:01_incr.log /var/lib/...
RonJohn's user avatar
  • 1,473
2 votes
2 answers
156 views

How does `*\ *` work in bash?

There is an answer from SuperUser, which renames filenames containing whitespace: for f in *\ *; do mv "$f" "${f// /_}"; done The part I don't understand is *\ *. The author wrote ...
glacier's user avatar
  • 491
9 votes
1 answer
672 views

Why does bash give the following result after brace expansion?

I am using linux and the following version of the bash: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) When I type: echo file{[1,2],3}.txt I expect brace expansion to be done first, so: ...
Yakog's user avatar
  • 517
0 votes
2 answers
158 views

variable assignment doesn't create one same object at least for grep

The problem is as follows (Here I don't use find since it doesn't support double-asterisk wildcard **): $ FILES=(foo/**/*.suffix bar/**/*.suffix2) $ grep baz "${FILES[@]}" # works # I use ...
An5Drama's user avatar
  • 173
4 votes
1 answer
141 views

Bash extglob with ignored pattern

Suppose I have these files: foo/bar/baz/test.js foo/bar/baz/test.min.js If I run: shopt -s globstar shopt -s extglob echo foo/bar/**/*!(.min).js ...that will nonetheless match the test.min.js file. ...
lonix's user avatar
  • 2,005
0 votes
0 answers
47 views

Trying to unrar specific files within a specific directory

I have a bash script that extracts files from a .rar file. I want to extract only *.foo and mydirectory/*.bar. I followed Unrar specific files using wildcards to get at the first group of files, but ...
Frotz's user avatar
  • 121
0 votes
1 answer
146 views

What wildcards will work with Make's .INTERMEDIATE target?

Isn't there some wildcard I can use for Make's .INTERMEDIATE target? $ cat Makefile .INTERMEDIATE: *.csv %.csv #failed .INTERMEDIATE: north.csv g.csv #worked Or must I list each and every file each ...
Dan Jacobson's user avatar
3 votes
2 answers
204 views

zsh completion - ignore executable files with no dot in the name

I am trying to ignore files that are executable and have no dot in them, because when I am coding in C I don't want to open the binary executable files with neovim. Here is what I am trying to achieve:...
Bog's user avatar
  • 1,154
-2 votes
4 answers
113 views

gnu grep multiple filters in one regex [closed]

RHEL 8, if it matters. I need to find all the rows in a text file which match these three filters: cut -f1 -d: .pgpass | grep ^FISP | grep -E 'CDS|TAP' | grep PGS401 FISPCDSPGS401A FISPCDSPGS401B ...
RonJohn's user avatar
  • 1,473
4 votes
4 answers
406 views

BASH - Find file with regex - Non-recursively delete number-only filenames in directory

I'm wanting to non-recursively delete all files in a directory where each filename contains only numbers, using only a single line of BASH. I somehow accidentally ran a shell script with commented out ...
Stev's user avatar
  • 61
3 votes
3 answers
277 views

Find and delete files from unix directory of multiple patterns

I need to delete files from a unix directory having patterns like 'bkp', 'backup', 'bak'. Basically I want to delete all the backup files. Files in the directory: A001.txt_bkp A001.txt A002.csv_backup ...
Mini's user avatar
  • 41
3 votes
2 answers
165 views

Zsh: Copy or Move symlinks to regular files, but not symlinks to directories (or vice versa)

In Zsh, to copy regular files, I can use cp source-dir/*(.) dest-dir/ to copy directories: cp source-dir/*(/) dest-dir/ to copy everything else, e.g., symlinks, pipes, and devices: cp source-dir/*(^./...
jsx97's user avatar
  • 1,357

15 30 50 per page
1
2 3 4 5
81