Results 1 to 3 of 3
Hi folks,
I've used "awk" to extract a list of filenames into a text file, which looks like this:
A008_C004_07141K.R3D
A009_C001_04233L.R3D
A102_C008_02186Q.R3D
etc
There are about 200 files in total. ...
- 01-29-2012 #1Just Joined!
- Join Date
- Jan 2012
- Posts
- 5
Pipe text file contents into "find" command then xargs into cpio
Hi folks,
I've used "awk" to extract a list of filenames into a text file, which looks like this:
A008_C004_07141K.R3D
A009_C001_04233L.R3D
A102_C008_02186Q.R3D
etc
There are about 200 files in total. I'm now trying to locate these files on a drive and copy them to another location. I've tried piping contents of the text file into a find command and then into cpio, but I can't work out how to make it clear to the find command that what I'm giving it is filenames. This is what I've come up with so far:
cat filenames.txt > find -name | cpio -pdmv /path/to/destination
Any brainy ideas would be much appreciated!
Best,
Patski
- 01-29-2012 #2Just Joined!
- Join Date
- Aug 2011
- Posts
- 48
My example, I don't have a file A.
$ cat t.txt
a.cpp
A
b.pl
$ cat t | xargs -Ifile find . -name 'file'
./c++/a.cpp
./perlCode/b.pl
$
On my Mac the xargs is -I but i have seen it as -i on my RedHat at work.
- 01-29-2012 #3Just Joined!
- Join Date
- Jan 2012
- Posts
- 5
Histrungalot,
That works brilliantly. Thanks a million!!!
Best,
Patski
QUOTE=histrungalot;878760]My example, I don't have a file A.
$ cat t.txt
a.cpp
A
b.pl
$ cat t | xargs -Ifile find . -name 'file'
./c++/a.cpp
./perlCode/b.pl
$
On my Mac the xargs is -I but i have seen it as -i on my RedHat at work.[/QUOTE]


Reply With Quote