|
|||||||
| UNIX Discussion Discuss the unix enviroment server and client side |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
|
Jeffrey Ross wrote:
> The other more general method is: > > ls | # to get all the files in the current directory > grep "\.class$" | # to filter out all except ones ending ".class" > xargs ls -l # to append those files to "ls -l" in batches keeping > under the maximum argument size > > Regards, > Jeffrey. does this work under csh as well? i'm going crazy trying to find a workaround for this error. i work for a vfx film house in los angeles and im constantly needed to grab info from a range of frames (represented as individual files), like so: 092_comp_01_shp.0935.cin 092_comp_01_shp.0936.cin 092_comp_01_shp.0937.cin 092_comp_01_shp.0938.cin 092_comp_01_shp.0939.cin 092_comp_01_shp.0940.cin so for instance, to find the 25th file in from the end of the range i'd do normally do this: set last = `ls -1 *.*.cin | tail -25 | head -1` which usually works fine - until i get a shot with a LOT of frames (like the above example), in which case i get the "arg list too long" error. so i attempted to implement jeffrey's solution thusly: set last = `ls -1 *.*.cin | xargs ls | tail -25 | head -1` and i get this: father 16% set last = `ls -1 *.*.cin | xargs ls | tail -25 | head -1` /sbin/ls: Arg list too long. father 17% echo $last 092_comp_01_shp.0916.cin so it works, but i still get the error msg. what am i doing wrong? i freely admit i have no idea how xargs works and the man page (like most of them), is depressingly cryptic and dense. any help is appreciated (even if i am in the wrong group - is there a csh group?) cheers christopher |
|
#2
|
|||
|
|||
|
[email]deepstructure@gmail.com[/email] wrote in
news:1111470754.951758.38930@f14g2000cwb.googlegro ups.com: > Jeffrey Ross wrote: >> The other more general method is: >> >> ls | # to get all the files in the current > directory >> grep "\.class$" | # to filter out all except ones ending ".class" >> xargs ls -l # to append those files to "ls -l" in batches > keeping >> under the maximum argument size >> >> Regards, >> Jeffrey. > > > does this work under csh as well? i'm going crazy trying to find a > workaround for this error. i work for a vfx film house in los angeles > and im constantly needed to grab info from a range of frames > (represented as individual files), like so: > > 092_comp_01_shp.0935.cin > 092_comp_01_shp.0936.cin > 092_comp_01_shp.0937.cin > 092_comp_01_shp.0938.cin > 092_comp_01_shp.0939.cin > 092_comp_01_shp.0940.cin > > > so for instance, to find the 25th file in from the end of the range i'd > do normally do this: > > set last = `ls -1 *.*.cin | tail -25 | head -1` > > which usually works fine - until i get a shot with a LOT of frames > (like the above example), in which case i get the "arg list too long" > error. > > so i attempted to implement jeffrey's solution thusly: > > set last = `ls -1 *.*.cin | xargs ls | tail -25 | head -1` > > and i get this: > > father 16% set last = `ls -1 *.*.cin | xargs ls | tail -25 | head -1` > /sbin/ls: Arg list too long. > father 17% echo $last > 092_comp_01_shp.0916.cin > > so it works, but i still get the error msg. what am i doing wrong? i > freely admit i have no idea how xargs works and the man page (like most > of them), is depressingly cryptic and dense. any help is appreciated > (even if i am in the wrong group - is there a csh group?) you get the same error because "ls -1 *.*.cin" will give you the error. Keep in mind that what you type on the command line IS NOT nessessary what the shell will execute. With a ksh shell just set ( set -x ) on the command line and you will see what a "ls /tmp/* " is really. But to solve our problem: ls -l | grep "\.cin$" | tail -25 | head -1 should do the job ls -l :will show everything but you do not get the " arg list to long " error grep "\.cin$" : will match everything that ends with ".cin" HTH Hajo |
|
#3
|
|||
|
|||
|
hey thanks. i just have one question - what does the $ stand for in
that line? im using csh, and $ is the variable call. what is it doing here? thanks for your help! much appreciated. |
|
#4
|
|||
|
|||
|
[email]deepstructure@gmail.com[/email] wrote in
news:1111561124.878648.44410@z14g2000cwz.googlegro ups.com: > hey thanks. i just have one question - what does the $ stand for in > that line? im using csh, and $ is the variable call. what is it doing > here? > > thanks for your help! much appreciated. > The "$" means End of File The "^" means Begin of File Example: You have two files in your directory ../start.end ../start.end.bkp ../next.start Now you would like to match only files that ENDS with ".end" ls | grep "\.end" would match both files ( lines ) ls | grep "\.end$" would match ONLY files (lines )that ENDS with ".end" ls | grep "^start\." would match ONLY files (lines) begining with "start." So the $ means for your shell a variable ( If a letter follows it ) but it does has a different meaning for grep,sed a.s.o Happy Programming Hajo |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Social Bookmarking List | kapilmark | Search Engine Optimization | 0 | 10-19-2009 12:04 PM |
| List of web hosts that support Java!!! | AutoBan | Web Hosting Discussion | 2 | 05-04-2009 06:16 AM |
| Honest List of good Hosts | lasurit | Web Hosting Discussion | 3 | 02-06-2009 12:43 AM |
| Big List of Ad Networks | Steve | Advertising & Affiliate Programs | 4 | 03-21-2007 09:44 PM |
| China Factory Nike Wholesale Suppliers Contacts | RokkerJon | Announcements, Suggestions, & Feedback | 0 | 09-03-2006 01:27 PM |