Skip to main content

All Questions

Tagged with
0 votes
1 answer
291 views

looping through filename [closed]

I need to use a function that has as input multiple files. These files are related by the filename (e.g. dog1_animal.txt, dog2_animal.txt, dog3_animal.txt, cat1_animal.txt, cat2_animal.txt, ...
wildos's user avatar
  • 1
0 votes
1 answer
232 views

pom.xml, **/pom.xml, **/**/pom.xml, then **/**/**/pom.xml... What shortcut to target a file we know its name, whatever its depth in directories?

To apply some changes to all my pom.xml files, I'm running these commands: git checkout --theirs **/**/**/**/pom.xml git checkout --theirs **/**/**/pom.xml git checkout --theirs **/**/pom.xml git ...
Marc Le Bihan's user avatar
3 votes
3 answers
2k views

Remove everything except csv file Bash Script

I would like to delete everything from a folder except csv files I am trying with a bash script and I am getting this error: syntax error near unexpected token `(' This is my script : PATH=/tmp/ ...
MobZSPARK's user avatar
-1 votes
1 answer
2k views

Bash wget with variables and wildcard

I've got a file despicting variables: IP_1="xx.xx.xx.xx" ID_1="yyyyy" IP_2="xx.xx.xx.xx" ID_2="yyyyy" ... IP_6="xx.xx.xx.xx" ID_6="yyyyy" ...
scotti's user avatar
  • 1
0 votes
2 answers
17k views

how to check if file exist based on file partial name [duplicate]

the way to check file as all know is like this [[ -f /var/scripts_home/orig_create_DB_files_1.46.38 ]] && echo file exist but how to check if file exist in case file contain name as - "...
yael's user avatar
  • 13.9k
1 vote
2 answers
93 views

How can I stack wildcards to target specific files?

I want to target all files called fooxxxbarxxx. The common thing among all those files is that it contains foo and bar. I've tried to use *foo*bar* and *foo**bar* but it doesn't work. Specifically,...
Felix L.'s user avatar
  • 125
1 vote
2 answers
1k views

When and why do I need to quote asterisks [duplicate]

I don't think I ever fully grokked the rules of when and why one needs to doublequote things in Linux/Bash (I'm not sure if this problem's domain is Linux, Bash, or something else). I thought that * ...
StoneThrow's user avatar
  • 1,917
3 votes
2 answers
2k views

getting error while running du -hs .[!.]*

I want to see sizes of all directory including hidden directory. One command I came across was this : du -hs .[!.]* but it is giving me error : du: cannot access ‘.[!.]*’: No such file or directory ...
Pramod's user avatar
  • 133
0 votes
1 answer
1k views

mkdir with brace expansion seems to fail when variables are used [duplicate]

Ubuntu 14.04.5 LTS GNU bash, Version 4.3.11(1)-release (x86_64-pc-linux-gnu) mkdir -vp test{1..3}/{a,b,c} works fine mkdir: created directory 'test1' mkdir: created directory 'test1/a' mkdir: ...
Dennis Nolte's user avatar
0 votes
1 answer
84 views

bash alias for creating .bup file copies of multiple files

I have my own custom .bashrc file. I practice my coding a lot so I use raw text and JDK. I use "shopt -s extglob". I need to create .bup copy of each file (non-recursively) and kill them after work ...
NapoleonTheCake's user avatar
0 votes
3 answers
3k views

why "ls *bash*" doesn't show the .bashrc file [duplicate]

I cd to my home directory and typed ls *bash* expecting it will show a list of files contains "bash". However it is not. While, typing ls .bash* works. According to the documentation, * stands ...
user15964's user avatar
  • 733
13 votes
5 answers
7k views

List files that match a pattern but ignore files that match another pattern?

Let's say I have a directory with files a1, a2, a3, b1, b2, b3. I only want to match files that start with a but don't contain 3. I tried ls -I "*3" *a* but it returns a1 a2 a3, even though I don't ...
Steven's user avatar
  • 715