This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Arg list too long - while using unix shell commands. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Arg list too long - while using unix shell commands." Watch "Arg list too long - while using unix shell commands." New topic
Author

Arg list too long - while using unix shell commands.

Peter Rooke
Ranch Hand

Joined: Oct 21, 2004
Posts: 810

Hi ranchers - just a quick Solaris shell question. I keep getting a - "arg list too long" as I'm dealing with a large volume of files. So for example:



My way round this would be to use a for loop:




But does anyone know how this can be done quicker? (thanks in advance )


Regards Pete
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Check out the xargs utility - it can be used to get around this problem. Not sure if it's going to be faster than using a loop, though.
Peter Rooke
Ranch Hand

Joined: Oct 21, 2004
Posts: 810

Thanks - speeds not an issue as I'm just tar'ing and compressing to make room! Got to keep the sys admins happy

Did a quick trawl on the web and found this: http://blog.kloppmagic.ca/archives/2004/12/21/using-xargs/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Arg list too long - while using unix shell commands.
 
It's not a secret anymore!