xargs is not a shell. It doesn't have a $1, $2, ... They just turn into whatever parameters the shell already had, if any (once and exactly once, before xargs is even run).
To be honest I'm not even sure what you're trying to do, what you expected $1 $2 ... to be.
xargs works like this:
Last edited by Corona688; 10-02-2014 at 10:16 PM..
Got a basic one to muddle through tonight; and hoping for a smidgen of help 'long the way
Here 'tis:
Simple enough; and to this amateur eye, it looks like things should work pretty well. But, of course, it tanks out...
What's the jot or tittle I might be missing this time?
Thanks a bunch!
The script you have shown us makes no sense to me at all. Instead of telling us it tanks out, it would be a lot easier to help you if you would tell us what you're trying to do.
As pointed out, xargs doesn't support positional arguments using $1, etc.
What you can do is use -I <replace string> to explictly tell xargs where to put the arguments in the command. It's worth noting that in this case that arguments are separated by newline, not just any whitespace as normal.
Thank you for the input. My apologies for any confusion, but I was trying to accomplish the same thing which most of us have done at one time or other with DOS's "COPY" commandline to copy select content of one directory over to another.
In the end, Aia's
worked well; along with Corona688's
My tinkering found, likewise, that
and
also did the trick using "find".
So I guess there's more than one way to cook a fish; but I can't help but wish there was something syntactically as simple as the old DOS "COPY" command for those of us who have moved along to UNIX...
Not sure whether I can post 'ant' related question here.
There is a requirement to convert files to UTF-8 format.
So, I tried this simple ant script.
<project name="try_copy" basedir="." default="copy_this">
<target name="copy_this">
<copy file="myfile.txt"... (2 Replies)
Hi,
I have a files in a directory as below :-
ls -1
mqdepth-S1STC02
proc-mq-S1STC01
proc-mq-S1STC02
proc-mq-S1STC03
Whereever i have S1STC i need to copy them into new file with file name S2STC.
expected output :-
ls -1
mqdepth-S2STC02
proc-mq-S2STC01
proc-mq-S2STC02... (3 Replies)
Hi guys i need advice on the approach to this one......
I have a file say called
Thisfile.20130524.txt
i need to work out from the date 20130524 what day of the week that was and then process the file in 3 working days. (so not counting saturday or sunday....(will not worry about bank... (2 Replies)
Hi experts
cp bin root src /mnt
but not copy bin/bigfile
any help?
( I post this thread in the "redhat" forum wrongly, I don't know how to withdraw that question in that wrong forum)
Thanks (6 Replies)
I have a problem using uucp. I have Ubuntu 10.4 and i installed the 'uucp' package.
In my LAN there are a desktop pc, a laptop, and the router
the desktop local ip is: 192.168.0.2
the laptop local ip is: 192.168.0.4
Here are the /etc/uucp/config and the /etc/uucp/sys i used on the desktop.... (4 Replies)
Hi all
I need to copy the entire contents of one file into an existing file at a specific location. I know the exact line number where I need to put it. It appears I would use either sed or awk to do this, but I have been unsuccessful so far:
File A
line 1
line 2
line 3
line 4
... (6 Replies)
Hi,
I have about enough UNIX knowledge to fill a thimble, but when a co-worker left I inherited an interface that runs Informatica on a UNIX box. I like UNIX, but my lack of skill is a real hindrance right now and I need to be able to archive the 9 csv files that are put in a directory by the FTP... (10 Replies)