Re: tar ten files each time
- From: Glenn Jackman <glennj@xxxxxx>
- Date: 4 Jun 2009 14:24:46 GMT
At 2009-06-03 09:34PM, "moonhkt" wrote:
Tested on AIX 5.2. Thank a lot
Can not able to using printf "%s\0" *
Can not able to using xargs -0
# printf "%s\n" * | xargs -L 10
a1.txt a2.txt a3.txt a4.txt abc.txt
# printf "%s\n" * | xargs -L 4
a1.txt a2.txt a3.txt a4.txt
abc.txt
[shkdev:/home/ericl6/temp]
You need a way to protect files with spaces. Consider this:
$ ls -1
a file with spaces
file1
file2
file3
file4
this file has spaces
$ printf "%s\n" * | xargs -L 3 perl -e 'print join(",", @ARGV), "\n"'
a,file,with,spaces,file1,file2
file3,file4,this,file,has,spaces
That's no good. How about adding single quotes around %s:
$ printf "'%s'\n" * | xargs -L 3 perl -e 'print join(",", @ARGV), "\n"'
a file with spaces,file1,file2
file3,file4,this file has spaces
Ah, better. Will still have trouble if any of your filenames have a
single quote in them. There's a better technique offered by Stephane
some time ago, but I haven't learned that lesson :(
--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous
.
- Follow-Ups:
- Re: tar ten files each time
- From: Michael Tosch
- Re: tar ten files each time
- References:
- tar ten files each time
- From: moonhkt
- Re: tar ten files each time
- From: Michael Tosch
- Re: tar ten files each time
- From: moonhkt
- tar ten files each time
- Prev by Date: Re: system calls
- Next by Date: Re: Need some small help on shell script - delete old files
- Previous by thread: Re: tar ten files each time
- Next by thread: Re: tar ten files each time
- Index(es):
Relevant Pages
|