>>>>> Martin Vaeth <
mar...@mvath.de> writes:
>>>>> Ivan Shmakov <
iv...@siamics.net> wrote:
[...]
>> that's no different to the other common text processing tools such
>> as Grep or Sed.
> These are sometimes easier to use if you really need only their very
> specialized functionality. But I wouldn't call these tools
> "programming language" (although with sed you can _pretend_ it is
> one).
Sed is Turing-complete, which makes it a programming language in
my book. Even if one inconvenient for solving other than some
specific tasks.
>> $ gawk '/foo/ { next; } 1 { print $2 - $1, $3; }' < file
> To mimick your syntax in perl:
> perl -ane 'if(/foo/) { next } print $F[1] - $F[0]," $F[2]\n"' < file
> A few characters longer but IMHO practically the same.
(Sometimes I wonder if the specification for the Perl "core"
dwarfs that of Common Lisp.)
Indeed, I was unaware of the "autosplit" mode; thanks.
> But already with the mentioned "find" you see the disadvantage of
> awk: It will work only correctly if you have find's GNU extensions -
> not only concerning the filenames but also concerning races
Specifically? Although I should note that I use GNU almost
exclusively, and as such, have little interest in environments
lacking GNU Find. (Other than perhaps those based on BusyBox.)
> - but even then there are a lot of restrictions of find, e.g. when
> you want to follow only _certain_ symlinks,
Care to provide an example on when that may be needed?
> want to stop when the total filelength reaches a certain limit etc.
> In perl, you can use simply File::Find which has neither of these
> restrictions,
My preference is to leave the file selection criteria outside
the scope of the software I write, thus allowing the user supply
any such criteria he or she fancies -- which I gather is not
quite feasible with File::Find. Well, aside from the fact that
the user /can/ indeed use File::Find in his own code to form the
list of files for my code to process.
> and moreover, it is also simple to write code which can be used
> unchanged on operating systems which use other directory conventions
> like f:\BLA\Foo ... Try to do that (with e.g. path related
> conditions) in GNU find...
Some such conditions can be specified with -regex.
Moreover, the systems that rely on non-Unix file naming
conventions require some adaptational layer for much of the
tools designed for Unix-like systems to run anyway, which means
the filename above is likely to denote the same file as, say,
/f:/BLA/Foo.
It's not a solution I like; but then again, I use such systems
only occasionally.