All Questions
56
questions
4
votes
2
answers
159
views
confusing about double quoting
I learned when I use command, double quoting treat all things as character except $, `, \ .
But, when use command like find -type f -name "*.jpg" *.jpg is inside double quotes. Then, it means we want ...
4
votes
4
answers
3k
views
How to escape shell metacharacters automatically with `find` command?
I've got a bunch of XML files under a directory tree which I would like to move to corresponding folders with the same name within that same directory tree.
Here is sample structure (in shell):
...
1
vote
1
answer
119
views
find command match issue [duplicate]
I'm having some trouble while searching files with find command and the way it handles the search.
Let's say I'm currently in the directory /tmp and the directory contains the files: backup-20151219....
21
votes
3
answers
16k
views
How does 'find -exec' pass file names with spaces?
If I have a directory containing some files whose names have spaces, e.g.
$ ls -1 dir1
file 1
file 2
file 3
I can successfully copy all of them to another directory like this:
$ find dir1 -mindepth ...
1
vote
2
answers
1k
views
Internal expansion with the find command and wildcard character [duplicate]
I'm still learning the command line and I am having some trouble fully understanding the use of the wildcard within the find command.
I'm working in the directory user/temp and use the find command ...
1
vote
1
answer
514
views
Having trouble with img2pdf and spaces in filenames
I am trying to convert a bunch of jpeg files to a pdf file.
When I type the filenames with the quotes all is fine:
$ img2pdf "./Page 001.jpg" "./Page 002.jpg" -o book.pdf
When I go for the ...
3
votes
2
answers
16k
views
Issue when I try passing parameters to find command?
Parameter:
export exc_lst='! -path "/var/app/s2/pnl/incoming/recondata/*.*"';
When I try using the below find commands:
find $FILE_DIR -name "*.*" "${exc_lst}" -type f -mtime +20 -user sh79790 -...
0
votes
2
answers
553
views
Recursively remove files with idx > 10,000
The problem
In the current working directory I have several (very many) folders and some of them have lots (like 100,000+) of files inside.
My goal is getting just the folder with 10,000+ files and ...
9
votes
4
answers
41k
views
How do I perform xargs grep on grep output that has spaces?
I'm searching for files based on a regular expression, and then I'm trying to search those files for content. So, for example, I have something like
#Find all C++ files that match a certain pattern ...
63
votes
5
answers
42k
views
How to quote arguments with xargs
Suppose that I want to delete all files in a folder that are greater than 1 MB.
$ find . -size +1M | xargs -0 rm
This will not delete files that have space in their names. So I want it to quote all ...
7
votes
4
answers
2k
views
what's the difference between using 'single quotes' or not in find command
find ~/ -name *test.txt
find ~/ -name '*test.txt'
I need to construct an example where the first form fails but the second still works.
1
vote
1
answer
2k
views
Using double or no quotes with wildcards
I came across this article which attempts to explain the find command.It gives an example of
find /tmp -iname "data*.txt"
now this article here states that
Double quotes do not suppress the ...
5
votes
1
answer
7k
views
Shell script, find -name, and wildcard expansion
I'm trying to use find -name in a sh script with a previously computed complex argument for the condition. Simplified, it goes like
cond="-name '*.txt*"
find . $cond -ls
But now I have the problem ...
2
votes
2
answers
7k
views
Using exec in find over ssh from shell script
So, I am attempting to execute the following from within a shell script;
ssh -q $CUR_HOST "cd $LOGS_DIR; echo cd $LOGS_DIR; find . -name *.log -mmin +1440 -exec gzip {} \; exit"
When this runs, it ...
10
votes
3
answers
51k
views
Why can't find -regex match a newline?
Why does this fail?
touch "$(printf "a\nb")"; find . -regex './.\n.'
I also tried these, none of which work:
find . -regextype posix-extended -regex '.\n.'
find . -regextype posix-awk -regex '.\n.'
...