Getting loc - Redhat

This is a discussion on Getting loc - Redhat ; Hi, I have asked this question before but cannot find the thread on Google Groups. Basicaly I want a line of shell code that counts the number of non blank lines of code in a file, directory or directory tree. ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Getting loc

  1. Getting loc

    Hi,

    I have asked this question before but cannot find the thread on Google
    Groups.

    Basicaly I want a line of shell code that counts the number of non blank
    lines of code in a file, directory or directory tree.

    Many thanks in advance,

    Aaron



  2. Re: Getting loc

    On Jun 7, 3:43 pm, "Aaron Gray" wrote:
    > Hi,
    >
    > I have asked this question before but cannot find the thread on Google
    > Groups.
    >
    > Basicaly I want a line of shell code that counts the number of non blank
    > lines of code in a file, directory or directory tree.
    >
    > Many thanks in advance,
    >
    > Aaron


    for a file or dir:

    grep -e '[a-zA-Z]' srcfile | wc

    for a tree it would be a bit more complicated. You'd need to sum up
    the outputs from the above.

    But really SLOC counts should omit comments too - thats a bit more
    tricky.

    C.

+ Reply to Thread