• (cs) in reply to Too Lazy To Sign In
    Too Lazy To Sign In:
    Well, WoW64 does make a twisted kind of sense if you write it out - Windows on Windows64.

    At first glance, I read that as World of Warcraft 64-bit; that's pretty sad, since I've never played that game, that Blizzard has still ingrained its branding in me.

  • no u (unregistered) in reply to Abdu
    Abdu:
    Frist! PS: Not spam...

    on what basis is this not spam? it adds nothing to the discussion, is not clever and is not even 'Frist'. It sounds like Askimet finally got something right.

  • tk421 (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    Hortical:
    C-Octothorpe:
    Hortical:
    So your life consists of jerking off in an internet cafe while talking to my many sockpuppets in comments threads on TDWTF.

    I'll let that sink in.

    YHBT YHL HAND

    I'll let that sink in.

    Hmmm...

    You admit to being an expendable loser (laid-off) with a narrow scope of expertise (doesn't understand unix) and I'm supposed to feel like the joke's on me?

    If it keeps you from killing yourself and entertaining us all day, I guess I'm fine with that.

    Well, the joke is on you because if you're too up-tight to recognize an obvious joke, then I feel really bad for you...

    Don't let me get in the way: nerd on brother!

    Right, I've never seen that one: After accidentally revealing I'm an idiot, and someone points it out, claim it's an obvious joke and make them guess about it.

  • Lucent (unregistered) in reply to no u
    no u:
    Abdu:
    Frist! PS: Not spam...

    on what basis is this not spam? it adds nothing to the discussion, is not clever and is not even 'Frist'. It sounds like Askimet finally got something right.

    I think spam is, by definition, sent out in mass.

  • (cs) in reply to tk421
    tk421:
    C-Octothorpe:
    Hortical:
    C-Octothorpe:
    Hortical:
    So your life consists of jerking off in an internet cafe while talking to my many sockpuppets in comments threads on TDWTF.

    I'll let that sink in.

    YHBT YHL HAND

    I'll let that sink in.

    Hmmm...

    You admit to being an expendable loser (laid-off) with a narrow scope of expertise (doesn't understand unix) and I'm supposed to feel like the joke's on me?

    If it keeps you from killing yourself and entertaining us all day, I guess I'm fine with that.

    Well, the joke is on you because if you're too up-tight to recognize an obvious joke, then I feel really bad for you...

    Don't let me get in the way: nerd on brother!

    Right, I've never seen that one: After accidentally revealing I'm an idiot, and someone points it out, claim it's an obvious joke and make them guess about it.

    I guess you're one of those people who thinks a joke is funnier when someone explains it, huh? (Get it? It had to get to the other side! LOL)

    And if wanking off in a public place doesn't make you pause and think "hmmm, maybe he's not being serious here", then you're either a little daft or you had your sense of humor surgically removed.

  • ted (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    Well, the joke *is* on you because if you're too up-tight to recognize an obvious joke, then I feel really bad for you...

    Maybe you're just not funny? Ever thought of that? 'cause you keep saying there's a joke in there but you're just covering up what a dumbass you are.

  • (cs) in reply to ted
    ted:
    C-Octothorpe:
    Well, the joke *is* on you because if you're too up-tight to recognize an obvious joke, then I feel really bad for you...

    Maybe you're just not funny

    Very likely...

  • tk421 (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    tk421:
    C-Octothorpe:
    Hortical:
    C-Octothorpe:
    Hortical:
    So your life consists of jerking off in an internet cafe while talking to my many sockpuppets in comments threads on TDWTF.

    I'll let that sink in.

    YHBT YHL HAND

    I'll let that sink in.

    Hmmm...

    You admit to being an expendable loser (laid-off) with a narrow scope of expertise (doesn't understand unix) and I'm supposed to feel like the joke's on me?

    If it keeps you from killing yourself and entertaining us all day, I guess I'm fine with that.

    Well, the joke is on you because if you're too up-tight to recognize an obvious joke, then I feel really bad for you...

    Don't let me get in the way: nerd on brother!

    Right, I've never seen that one: After accidentally revealing I'm an idiot, and someone points it out, claim it's an obvious joke and make them guess about it.

    I guess you're one of those people who thinks a joke is funnier when someone explains it, huh? (Get it? It had to get to the other side! LOL)

    And if wanking off in a public place doesn't make you pause and think "hmmm, maybe he's not being serious here", then you're either a little daft or you had your sense of humor surgically removed.

    PPPPFFFTT! HA HA HA HA HA!!

    You're calling me oblivious when you thought I was being serious when I jokingly took you seriously! That's why I didn't know what you meant! I'm like "what's he talking about?" and then I realized "oh, this is like being called stupid by a retard! he's too stupid to know what stupidity is!"

    ha ha oh, man...

    It's like - you come here every day make a fool of yourself, but I still like having you here anyway. Never leave.

    Cue lame attempt to re-garner self-esteem that C-Octo is known for

  • (cs)

    Does wc no longer take an input file as an argument? WhyTF did he cat the file?

    Methinks this guy just loves piping!

  • (cs) in reply to tk421
    tk421:
    PPPPFFFTT! HA HA HA HA HA!!

    You're calling me oblivious when you thought I was being serious when I jokingly took you seriously! That's why I didn't know what you meant! I'm like "what's he talking about?" and then I realized "oh, this is like being called stupid by a retard! he's too stupid to know what stupidity is!"

    ha ha oh, man...

    It's like - you come here every day make a fool of yourself, but I still like having you here anyway. Never leave.

    Cue lame attempt to re-garner self-esteem that C-Octo is known for

    Ok, so let me get this straight: I'm retarded because I didn't get you were joking with me, but you're brilliant because you didn't realize I was joking?

    Whatever makes you feel better...

  • (cs)

    Could have been worse; this is in our code base as part of a larger script - written by a self proclaimed DOS batch expert as part of Linux pre-processing:

    #!/bin/ksh
    # Determine the number of non-blank lines contained in a file
    if [[ -z $1 ]]; then 
       echo "Usage: $0 fileName"
       exit 1
    fi
    typeset -i n=0
    while read line; do # ksh strips leading/trailing white space/blank lines
      if [[ "$line" != "" ]]; then
         (( n = n + 1 ))
      fi
    done < $1
    echo $n
    
  • (cs) in reply to boog
    boog:
    Methinks this guy just loves piping!
    Who doesn't?
  • Childish (unregistered) in reply to dohpaz42
    dohpaz42:
    "Not long ago, I was poking around one of our production web servers and noticed the following curiosity in a shell script," writes Marshall G.
    /bin/cat /var/run/netstat_r.lst | /usr/bin/wc | /usr/bin/cut -b -8 |perl -e 'my $r=<>; $r =~ s/^\s+//; print "$r"'

    "Since the command only counts the number of lines in netstat_r.lst, I'm perplexed at the complexity of this approach."

    "Especially since the author thought to use the wc command but not the -l option."

    TRWTF is um perl?

    The best part is that Perl only eats the extra spaces, LTRIM(line_count). Either use Perl to do the whole thing, or shell commands. Never do both.

    Personally, I see /bin/cat is TRWTF since it does nothing but put the file on the STDIN stream.

  • Camel (unregistered)

    When perl is allowed, here's my one-liner:

    perl -e 'print @{[<>]}."\n"' /var/run/netstat_r.lst
    
  • (cs) in reply to frits
    frits:
    boog:
    Methinks this guy just loves piping!
    Who doesn't?
    Good point.

    Well, back to work...

    cat /dev/random >/dev/null &  # just for the hell of it
  • (cs) in reply to Camel
    Camel:
    When perl is allowed, here's my one-liner:
    perl -e 'print @{[<>]}."\n"' /var/run/netstat_r.lst
    
    When perl is required, here's mine:
    perl -e 'print `wc -l /var/run/netstat_r.lst`'
  • HP PhaserJet (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    And if wanking off in a public place doesn't make you pause and think "hmmm, maybe he's *not* being serious here", then you're either a little daft or you had your sense of humor surgically removed.

    It depends - are you doing it in the bathroom of a public place? I remember seeing a study where a surprising number of men would do it in a bathroom stall at work. (~20%) I did when I was an intern.

    So, sure you were joking, but there's also a good chance that you weren't

  • rfoxmich (unregistered)

    They removed -l from wc in the very embedded platform this runs in...so they could fit perl into the memory footprint.

  • empire (unregistered)

    DAE think it's a bit weird that he uses the fully qualified names for all of the executables (except Perl)? In what case is /bin not on the path? In what case is /usr/bin not on the path either? Yet, it almost certainly is, since perl is usually in /usr/bin. Crazy.

  • Camel (unregistered) in reply to boog
    boog:
    Camel:
    When perl is allowed, here's my one-liner:
    perl -e 'print @{[<>]}."\n"' /var/run/netstat_r.lst
    
    When perl is required, here's mine:
    perl -e 'print `wc -l /var/run/netstat_r.lst`'
    That is incorrect, it prints
    xxx /var/run/netstat_r.lst
    

    Should use

    perl -e 'print `wc -l </var/run/netstat_r.lst`'
    </pre>
    
  • tk421 (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    tk421:
    PPPPFFFTT! HA HA HA HA HA!!

    You're calling me oblivious when you thought I was being serious when I jokingly took you seriously! That's why I didn't know what you meant! I'm like "what's he talking about?" and then I realized "oh, this is like being called stupid by a retard! he's too stupid to know what stupidity is!"

    ha ha oh, man...

    It's like - you come here every day make a fool of yourself, but I still like having you here anyway. Never leave.

    Cue lame attempt to re-garner self-esteem that C-Octo is known for

    Ok, so let me get this straight: I'm retarded because I didn't get you were joking with me, but you're brilliant because you didn't realize I was joking?

    Whatever makes you feel better...

    facepalm

    No, you're retarded because you didn't even get it when I explained it to you directly just a minute ago.

    Just read it again, 10th try's the charm!

  • trtrwtf (unregistered) in reply to tk421
    tk421:
    C-Octothorpe:
    tk421:
    PPPPFFFTT! HA HA HA HA HA!!

    You're calling me oblivious when you thought I was being serious when I jokingly took you seriously! That's why I didn't know what you meant! I'm like "what's he talking about?" and then I realized "oh, this is like being called stupid by a retard! he's too stupid to know what stupidity is!"

    ha ha oh, man...

    It's like - you come here every day make a fool of yourself, but I still like having you here anyway. Never leave.

    Cue lame attempt to re-garner self-esteem that C-Octo is known for

    Ok, so let me get this straight: I'm retarded because I didn't get you were joking with me, but you're brilliant because you didn't realize I was joking?

    Whatever makes you feel better...

    facepalm

    No, you're retarded because you didn't even get it when I explained it to you directly just a minute ago.

    Just read it again, 10th try's the charm!

    Guys, I don't see that there's any disagreement here. You each say the other is retarded and not funny. You're both right.

  • (cs) in reply to snoofle
    snoofle:
    Could have been worse; this is in our code base as part of a larger script - written by a self proclaimed DOS batch expert as part of Linux pre-processing:
    #!/bin/ksh
    # Determine the number of non-blank lines contained in a file
    if [[ -z $1 ]]; then 
       echo "Usage: $0 fileName"
       exit 1
    fi
    typeset -i n=0
    while read line; do # ksh strips leading/trailing white space/blank lines
      if [[ "$line" != "" ]]; then
         (( n = n + 1 ))
      fi
    done < $1
    echo $n
    

    Kinda like what we saw here two days ago. Whether it's SQL or ksh, failure to learn your tools leads to gross inefficiency.

  • ted (unregistered) in reply to trtrwtf
    trtrwtf:
    tk421:
    C-Octothorpe:
    tk421:
    PPPPFFFTT! HA HA HA HA HA!!

    You're calling me oblivious when you thought I was being serious when I jokingly took you seriously! That's why I didn't know what you meant! I'm like "what's he talking about?" and then I realized "oh, this is like being called stupid by a retard! he's too stupid to know what stupidity is!"

    ha ha oh, man...

    It's like - you come here every day make a fool of yourself, but I still like having you here anyway. Never leave.

    Cue lame attempt to re-garner self-esteem that C-Octo is known for

    Ok, so let me get this straight: I'm retarded because I didn't get you were joking with me, but you're brilliant because you didn't realize I was joking?

    Whatever makes you feel better...

    facepalm

    No, you're retarded because you didn't even get it when I explained it to you directly just a minute ago.

    Just read it again, 10th try's the charm!

    Guys, I don't see that there's any disagreement here. You each say the other is retarded and not funny. You're both right.

    Go ahead, join the party, you'll fit in with this crowd.

  • (cs) in reply to Camel
    Camel:
    That is incorrect, it prints
    xxx /var/run/netstat_r.lst
    

    Should use

    perl -e 'print `wc -l </var/run/netstat_r.lst`'
    </pre>
    Details details...
  • (cs) in reply to Lucent
    Lucent:
    no u:
    Abdu:
    Frist! PS: Not spam...

    on what basis is this not spam? it adds nothing to the discussion, is not clever and is not even 'Frist'. It sounds like Askimet finally got something right.

    I think spam is, by definition, sent out in mass.

    Must... not... be... pedantic... Oh, what the Hell, this is TDWTF after all:

    By definition*, spam as a noun - as used in this case - means, "A canned meat product made mainly from ham." When used as a verb, as if to say, "I spammed TDWTF forums today.", then it means, "Send the same message indiscriminately to (large numbers of recipients) on the Internet."

    So, therefore, the OP technically was correct. His post was in fact: not spam.

  • tk421 (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    tk421:
    PPPPFFFTT! HA HA HA HA HA!!

    You're calling me oblivious when you thought I was being serious when I jokingly took you seriously! That's why I didn't know what you meant! I'm like "what's he talking about?" and then I realized "oh, this is like being called stupid by a retard! he's too stupid to know what stupidity is!"

    ha ha oh, man...

    It's like - you come here every day make a fool of yourself, but I still like having you here anyway. Never leave.

    Cue lame attempt to re-garner self-esteem that C-Octo is known for

    Ok, so let me get this straight: I'm retarded because I didn't get you were joking with me, but you're brilliant because you didn't realize I was joking?

    Whatever makes you feel better...

    And in the most generic form possible. What reason do you have to say "Whatever makes you feel better" other than to trivialize what I said to make yourself feel better?

  • Lucent (unregistered) in reply to dohpaz42
    dohpaz42:
    Lucent:
    no u:
    Abdu:
    Frist! PS: Not spam...

    on what basis is this not spam? it adds nothing to the discussion, is not clever and is not even 'Frist'. It sounds like Askimet finally got something right.

    I think spam is, by definition, sent out in mass.

    Must... not... be... pedantic... Oh, what the Hell, this is TDWTF after all:

    By definition*, spam as a noun - as used in this case - means, "A canned meat product made mainly from ham." When used as a verb, as if to say, "I spammed TDWTF forums today.", then it means, "Send the same message indiscriminately to (large numbers of recipients) on the Internet."

    So, therefore, the OP technically was correct. His post was in fact: not spam.

    Exactly, the spam filter is there to keep advertisers from carpet-bombing messages, not to keep people from posting stupid stuff. It's obviously not the latter would be devoid of... well... the usual suspects.

  • (cs) in reply to Lucent
    Lucent:
    Exactly, the spam filter is there to keep advertisers from carpet-bombing messages, not to keep people from posting stupid stuff. It's obviously not the latter would be devoid of... well... the usual suspects.

    Well, being pedantic again, there is a theory that those "usual suspects" are in fact actually just one person, so it would be grammatically incorrect to pluralize suspects. ;)

  • Lucent (unregistered) in reply to dohpaz42
    dohpaz42:
    Lucent:
    Exactly, the spam filter is there to keep advertisers from carpet-bombing messages, not to keep people from posting stupid stuff. It's obviously not the latter would be devoid of... well... the usual suspects.

    Well, being pedantic again, there is a theory that those "usual suspects" are in fact actually just one person, so it would be grammatically incorrect to pluralize suspects. ;)

    Then I'll have to be pedantic in turn: They are definitely not one person, because I am some of them, but not others. So it's at least two people, and therefore "suspects" should remain plural. Thank you and have a nice day.

  • The Great Lobachevsky (unregistered) in reply to justsomedude
    justsomedude:
    Windozer:
    C-Octothorpe:
    Oh great, I can hear the stampede of linux geeks waddling to their keyboards now...

    What's a wc? What's a perl? Why do all of these backslashes go the wrong way? What's going on? HALP ME, I DON'T UNDERSTAND!!!

    It's okay dear. Here, come sit down and play some minesweeper.

    I would, but IT took it off my computer.

    captcha: suscipere : I'm suscipere of the IT department.

  • That guy over there (unregistered) in reply to random_garbage
    random_garbage:
    Actually, IIRC, for historical reasons, Win64 still keeps all the relevant 64-bit libraries, etc. in the System32 folder.

    For maximum fun, the 32-bit compatibility libraries are stored in the WoW64 folder...

    Figure that one out...

    WoW64 apparently stands for “Windows 32-bit On Windows 64-bit”, so that part makes sense. I’m sure there’s a reason why it’s still %WinDir%/System32 too, probably because there’s no path variable for it and has to be hard-coded into programs. Then again, there’s pretty much no reason to put anything in there, but that’s a discussion for another time.

  • (cs) in reply to Anonymous Coward
    Anonymous Coward:
    But this version supports platforms where wc doesn't have -l.

    It's totally non-portable, though, if the platform doesn't have wc.

  • (cs) in reply to C-Octothorpe
    C-Octothorpe:
    HA HA HA HA!! Ok, so let me get this straight: I'm retarded.

    FTFY.

    You're retarded because you keep saying stupid, irrelevant shit. And you pretend that the people calling you on it are in some cabal against you. There's no cabal, just people annoyed at your tiresome babble.

    But you win, and everybody else loses. Just stfu already. Nobody likes a sore winner.

    Everybody else: DO NOT FEED THE TROLL.

  • laff (unregistered) in reply to Lucent
    Lucent:
    dohpaz42:
    Lucent:
    Exactly, the spam filter is there to keep advertisers from carpet-bombing messages, not to keep people from posting stupid stuff. It's obviously not the latter would be devoid of... well... the usual suspects.

    Well, being pedantic again, there is a theory that those "usual suspects" are in fact actually just one person, so it would be grammatically incorrect to pluralize suspects. ;)

    Then I'll have to be pedantic in turn: They are definitely not one person, because I am some of them, but not others. So it's at least two people, and therefore "suspects" should remain plural. Thank you and have a nice day.

    I am Lucent. I was lying. I am just one person.

  • (cs) in reply to Camel
    Camel:
    When perl is allowed, here's my one-liner:
    perl -e 'print @{[<>]}."\n"' /var/run/netstat_r.lst
    

    I don't believe that does what you think it does. It'll do the same thing as:

    perl -e '@list = <>; print "@list\n";'
    

    which will merely print the entire file with spaces prepended to all lines but the first.

  • (cs) in reply to laff
    laff:
    Lucent:
    dohpaz42:
    Lucent:
    Exactly, the spam filter is there to keep advertisers from carpet-bombing messages, not to keep people from posting stupid stuff. It's obviously not the latter would be devoid of... well... the usual suspects.

    Well, being pedantic again, there is a theory that those "usual suspects" are in fact actually just one person, so it would be grammatically incorrect to pluralize suspects. ;)

    Then I'll have to be pedantic in turn: They are definitely not one person, because I am some of them, but not others. So it's at least two people, and therefore "suspects" should remain plural. Thank you and have a nice day.

    I am Lucent. I was lying. I am just one person.

    I feel so dirty... Kind of like in Bachelor Party where dude finds out the hot chick is really a dude.

  • (cs)

    I believe this counts non-blank lines:

    cat file | grep -v "^[ \t]*$" | wc -l

    I know, save the cats! But I like using cat in front of a long pipe because it's clearer to me.

  • laff (unregistered) in reply to dohpaz42
    dohpaz42:
    laff:
    Lucent:
    dohpaz42:
    Lucent:
    Exactly, the spam filter is there to keep advertisers from carpet-bombing messages, not to keep people from posting stupid stuff. It's obviously not the latter would be devoid of... well... the usual suspects.

    Well, being pedantic again, there is a theory that those "usual suspects" are in fact actually just one person, so it would be grammatically incorrect to pluralize suspects. ;)

    Then I'll have to be pedantic in turn: They are definitely not one person, because I am some of them, but not others. So it's at least two people, and therefore "suspects" should remain plural. Thank you and have a nice day.

    I am Lucent. I was lying. I am just one person.

    I feel so dirty... Kind of like in Bachelor Party where dude finds out the hot chick is really a dude.

    Well you don't have to worry about that here, I'm a chick pretending to be a bunch of dudes. Better?

  • Solomon (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    Oh great, I can hear the stampede of linux geeks waddling to their keyboards now...

    This is actually a very funny joke I laughed even though I grew up on Unix. It's a joke you see because Penguins waddle, and so do fat programmers. (btw it's the new vogue on TDWTF to bash fat people, probably because they smell).

    I don't think many people will get this joke though, because everyone's so touchy nowadays what with this global recession an' all.

    I hope the rest of the comments are as good as this one.

  • Solomon (unregistered) in reply to Solomon
    Solomon:
    C-Octothorpe:
    Oh great, I can hear the stampede of linux geeks waddling to their keyboards now...

    This is actually a very funny joke I laughed even though I grew up on Unix. It's a joke you see because Penguins waddle, and so do fat programmers. (btw it's the new vogue on TDWTF to bash fat people, probably because they smell).

    I don't think many people will get this joke though, because everyone's so touchy nowadays what with this global recession an' all.

    I hope the rest of the comments are as good as this one.

    oh ffs. That's it, i'm formatting every machine I own and moving them over to pirated copies of Windows server. I cannot be associated with these people. I will never admit to knowing the syntax for wc ever again, even if my life depends on it (which seems fairly unlikely tbh).

    what a bunch of humourless overweight beardy freaks.

  • (cs) in reply to Captain Oblivious
    Captain Oblivious:
    C-Octothorpe:
    HA HA HA HA!! Ok, so let me get this straight: I'm retarded.

    FTFY.

    You're retarded because you keep saying stupid, irrelevant shit. And you pretend that the people calling you on it are in some cabal against you. There's no cabal, just people annoyed at your tiresome babble.

    But you win, and everybody else loses. Just stfu already. Nobody likes a sore winner.

    Everybody else: DO NOT FEED THE TROLL.

    Although I pretty much agree with everything you said, I don't think C-Poundsign claimed a cabal was against him. Now he might. You don't play poker much, do you?

  • Russ Huguley (unregistered)

    grep -v ^\ *$ /var/run/netstat_r.lst |wc -l

  • trtrwtf (unregistered) in reply to Solomon
    Solomon:
    what a bunch of humourless overweight beardy freaks.

    For the record, I haven't got a beard.

  • Accalia.de.Elementia (unregistered) in reply to Russ Huguley
    Russ Huguley:
    grep -v ^\ \*$ /var/run/netstat_r.lst -c

    FTFY. no need for the WC if you only want the number of lines

  • (cs)

    I don't know which pisses me off more. UNIX/Linux humor or the people that find it funny.

    Probably the people.

  • (cs) in reply to SteamBoat
    SteamBoat:
    I don't know which pisses me off more. UNIX/Linux humor or the people that find it funny.

    Probably the people.

    You rang?...

  • Marc (unregistered)

    My favorite script:

    :(){ :|:& };:

  • (cs) in reply to SteamBoat
    SteamBoat:
    I don't know which pisses me off more. UNIX/Linux humor or the people that find it funny.

    Probably the people.

    Totally.

    Same goes for people who makes jokes in foreign languages and cultures that I'm not familiar with or don't understand. It pisses me off that these people persistently make jokes that I don't get.

  • (cs) in reply to cihv
    cihv:
    I don't work with toilets on the command line so I count lines with awk:
    awk '{lines++}END{print lines}' <filename>
    That is just too AWKward!

Leave a comment on “How Not to Count Lines”

Log In or post as a guest

Replying to comment #351640:

« Return to Article