This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cp: omitting directory, for copying only files, sed


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi David,

On 6 Nov 2010, at 13:15, David wrote:

I have a script:

#!/bin/bash
W="\/cygdrive\/c\/Users\/dbj\/workspace\/$1\/."

Why do you escape the directory separators?


echo $W
sed -n 's/^File[ ]*\([^ ][^ ]*\).*/\"\1\" '"$W"'/p' < $2 | xargs cp

Oh, you're using '/' as string delimiter. Use ':'. I.e.: sed -n 's:/^File...:\1...:p'


Then I do


$ ./cptest1.sh test list.txt
\/cygdrive\/c\/Users\/dbj\/workspace\/test\/.
cp: omitting directory `/cygdrive/c/Users/dbj/workspace/test/.'

Why do I get "cp: omitting directory"?

I ran this script (on MacOSX):


#!/bin/sh
W="\/Users\/edgarm\/tmp\/$1\/."
echo $W
sed -n 's/^File[ ]*\([^ ][^ ]*\).*/\"\1\" '"$W"'/p' < $2 | xargs echo X:

And this is the output...

tmp$ ./cptest1 test list.txt
\/Users\/edgarm\/tmp\/test\/.
X: ..\test\file1.txt /Users/edgarm/tmp/test/. ..\test\file2.txt /Users/ edgarm/tmp/test/.


See the problem?

Regards, Edgar Matzinger.
- --
                                                        ''~``
                                                       ( o o )
+-------------------------------------------------.oooO--(_)--Oooo.---+

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iQEcBAEBAgAGBQJM1WJMAAoJEENMxv7g8VYwX0sH/2qMyYX0FK/GVEz1dcXkuxV0
mbBTCjcwOmd7fBcoSgWCjctkYYI9pS3RqCJaEk9C1JU+aWLdGJd5rk1SubAsk+en
usgkUSUDePq/+oU8RR4ZQhBNkhj60j+4aFieAjLxO3ZtWjp8U1P8JSVPNcDIwavo
f0dYDI/ivKj0BmpBe/rYbuJ2G3UIs2vivkKZXrRDNC21otBArb4HS84S3alc6M+E
vgk1r0gKBrBjDHp7tCIQNZ5bYob6x6mQdtqHZFgnx1/SJ9L5Db5lEkx4BcxLCCC3
FPm6msjZcDKy/OJYGTLYFvT6Tn+6hI5nPERO9pxERKGvrhnIt41i8w16YzIaVfo=
=IErD
-----END PGP SIGNATURE-----

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]