bash limits ?

Peter L. Peres plp-ysDPMY98cNQDDBjDh4tngg at public.gmane.org
Fri Sep 10 21:52:55 UTC 2004


On Thu, 9 Sep 2004, Chris F.A. Johnson wrote:

> On Thu, 9 Sep 2004, Peter L. Peres wrote:
>> 
>> The exact command I'm using is:
>> 
>> SORTED=$(find $TMPDIR/* -type f|grep -E [0-9]+|cut -d'/' -f4|sort)
>
>    What error message is it giving you?

Maybe I did not make myself clear: I do not get an error, some filenames 
simply get eaten is $SORTED is long enough. They are in $SORTED (I 
checked) but after I submit $SORTED to for ... they are gone. I will have 
to check again. Maybe I'm just wasting time and should go directly for a 
Perl solution.

>    And wouldn't this do what you want:
>
> SORTED=`find $TMPDIR -type -f -name '*[0-9]*' -printf "%f\n"`

It should but it will get more complicated later, I will want to prune 
certain filenames (intersect with a list and keep what is not in it). It 
will probably be done in Perl later, I just tinker with the ideas for now. 
I would like to know what's broken ?

>> where the argument of find should expand to no more than 100 entries (102 
>> with . and ..). the entries are guaranteed unique so that's not a problem. 
>> The cut -f4 matches several slashes which are in TMPDIR and leaves just 
>> the [0-9]{8} filename part to sort. Unfortunately basename cannot be used 
>> in a pipe (why did they write it like that ? - I should write a 
>> replacement that can be used in a pipe !).
>
> awk -F/ '{printf $NF}'
>
> -- 
> 	Chris F.A. Johnson                      http://cfaj.freeshell.org
> 	=================================================================
>                Everything in moderation -- including moderation
> --
> The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
>
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list