Searching all downloaded files in a file list
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I've downloaded some files. I want to find out whether these file names are present in file.txt one by one. I've tried following command but not successful. I want to find out using xargs
.
ls | xargs grep file.txt
How do I do that?
command-line xargs
add a comment |Â
up vote
0
down vote
favorite
I've downloaded some files. I want to find out whether these file names are present in file.txt one by one. I've tried following command but not successful. I want to find out using xargs
.
ls | xargs grep file.txt
How do I do that?
command-line xargs
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I've downloaded some files. I want to find out whether these file names are present in file.txt one by one. I've tried following command but not successful. I want to find out using xargs
.
ls | xargs grep file.txt
How do I do that?
command-line xargs
I've downloaded some files. I want to find out whether these file names are present in file.txt one by one. I've tried following command but not successful. I want to find out using xargs
.
ls | xargs grep file.txt
How do I do that?
command-line xargs
asked Oct 28 '17 at 11:05
Nayab Basha Sayed
1035
1035
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Though I'm not sure what exactly means your "one by one" but here is
Short ls
+ grep
approach:
ls -1 | grep -wf - file.txt
-1
-ls
option, lists one file per line-f file
-grep
option, obtains patterns fromfile
(or STDIN in case of passing-
argument), one per line
The same could be written as:
grep -wf <(ls -1) file.txt
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Though I'm not sure what exactly means your "one by one" but here is
Short ls
+ grep
approach:
ls -1 | grep -wf - file.txt
-1
-ls
option, lists one file per line-f file
-grep
option, obtains patterns fromfile
(or STDIN in case of passing-
argument), one per line
The same could be written as:
grep -wf <(ls -1) file.txt
add a comment |Â
up vote
0
down vote
accepted
Though I'm not sure what exactly means your "one by one" but here is
Short ls
+ grep
approach:
ls -1 | grep -wf - file.txt
-1
-ls
option, lists one file per line-f file
-grep
option, obtains patterns fromfile
(or STDIN in case of passing-
argument), one per line
The same could be written as:
grep -wf <(ls -1) file.txt
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Though I'm not sure what exactly means your "one by one" but here is
Short ls
+ grep
approach:
ls -1 | grep -wf - file.txt
-1
-ls
option, lists one file per line-f file
-grep
option, obtains patterns fromfile
(or STDIN in case of passing-
argument), one per line
The same could be written as:
grep -wf <(ls -1) file.txt
Though I'm not sure what exactly means your "one by one" but here is
Short ls
+ grep
approach:
ls -1 | grep -wf - file.txt
-1
-ls
option, lists one file per line-f file
-grep
option, obtains patterns fromfile
(or STDIN in case of passing-
argument), one per line
The same could be written as:
grep -wf <(ls -1) file.txt
edited Oct 28 '17 at 11:23
answered Oct 28 '17 at 11:11
RomanPerekhrest
22.5k12145
22.5k12145
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401044%2fsearching-all-downloaded-files-in-a-file-list%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password