in reply to Re: Using Perl saves time....
in thread Using Perl saves time....

In Using Perl saves time....:
ls -1 | wc
In Re: Using Perl saves time....:
Why did you use -l for the ls?
I think your computer is not showing you the difference between a digit one and the letter ell. The original post is an (unnecessary) digit one. You're complaining rightly about the expense of a letter ell long listing (if that was indeed the case).

It's unnecessary because ls has two behaviors, depending on whether the output is a terminal or not (something I count as being broken, but oh well). To a terminal, it columnizes, but to a pipe or file, it's automatically one element per line (classic mode). Thank the idiots at Bezerkley for this abomination. This leads people to believe that they need to add "-1" to get one column, when in fact that's usually not necessary.

As an example, compare "ls" with "ls | cat".

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^3: Using Perl saves time....
by szabgab (Priest) on Jul 18, 2005 at 11:50 UTC
    Oh, you are right I did not have to use -1 (one) as ls|wc counts the same as ls -1|wc

    You learn something every time...

Re^3: Using Perl saves time....
by fergal (Chaplain) on Jul 18, 2005 at 11:51 UTC
    I didn't even think of the -1 (one) option, I thought he was using -l to make sure it was one line per file or something.

    Still it's odd that it's so slow, maybe AIX is just nasty.

Re^3: Using Perl saves time....
by Ultra (Hermit) on Jul 18, 2005 at 12:31 UTC

    ... Thank the idiots at Bezerkley ...

    It's a joke, right?

    Dodge This!
      What part of it is a joke? "ls" worked fine coming out of Bell Labs. Then one of the BSD releases out of Berkeley added this behavior. Thus, it's a Berkeley (aka Bezerkley when they do something weird) product.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        Depending on what you expect from ls, you may say it acts stupid or not. But IMHO, this is not a reason to say that Berkeley people are stupid.

        Anyone is free to write software how they like it to behave. Stupid may be considered those that copy blindly that software ...

        And to some extent stupid may be considered those that just use it, keep complaining about it, and don't provide their modification, when they could patch it to suit their own needs. (I'm not talking here about non-programmers).

        Dodge This!