>> I imagine that there are more advanced possibilities to improve the software
>> run time characteristics for this use case.
> 
> Well, if it has to be fast, perhaps don't write the code in the shell 
> language.

To which “shell” would you like to refer to?


> Even an interpreted scripting language that can do string handling without
> resorting to fork()-based command substitution will beat the shell at many 
> tasks.

How do you think about additional approaches to reduce the forking of special 
processes?


>> I would like to avoid such an operation “Remove matching prefix pattern” 
>> generally.
>> If the desired file lists contain only basenames, extra prefixes do not need
>> to be deleted.
> 
> I.e. we can use the basename function:
> 
>   for name in dir/*txt; do
>     basename "$name"
>   done
> 
> prints the basenames of the matching files, one per line.

There is also the GNU variant available for such a command.

   for X in $(basename --suffix=.txt dir/*txt); do my_work $X; done


But how often can it be avoided to delete extra data like prefixes (and 
suffixes)?

Can it occasionally be a bit more efficient to provide only the essential
values at the beginning of an algorithm so that so they will be extended on 
demand?

Regards,
Markus

Reply via email to