Subj : Re: Getting the number of lines in a file To : comp.os.linux From : cj Date : Fri Jul 23 2004 10:42 am wc -l (lower case L): wc Print byte, word, and line counts, count the number of bytes, whitespace-separated words, and newlines in each given FILE, or standard input if none are given or for a FILE of `-'. SYNTAX wc [OPTION]... [FILE]... OPTIONS -c --bytes --chars Print only the byte counts. -w --words Print only the word counts. -l --lines Print only the newline counts. -L --max-line-length Print only the length of the longest line per file, and if there is more than one file it prints the maximum (not the sum) of those lengths. `wc' prints one line of counts for each file, and if the file was given as an argument, it prints the file name following the counts. If more than one FILE is given, `wc' prints a final line containing the cumulative counts, with the file name `total'. The counts are printed in this order: newlines, words, bytes. By default, each count is output right-justified in a 7-byte field with one space between fields so that the numbers and file names line up nicely in columns. However, POSIX requires that there be exactly one space separating columns. You can make `wc' use the POSIX-mandated output format by setting the `POSIXLY_CORRECT' environment variable. By default, `wc' prints all three counts. Options can specify that only certain counts be printed. Options do not undo others previously given, so wc --bytes --words will print both the byte counts and the word counts. "One look is worth a thousand words" - Fred R. Barnard Related commands: cat - Display the contents of a file cal - Display a calendar units - Convert units from one scale to another Equivalent Windows NT commands: none "Joshua Beall" wrote in message news:aR7Mc.24348$Iz3.12150@nwrddc01.gnilink.net... > Hi All, > > What I really want to do is get the cumulative number of lines in many > files, recursing into subdirectories. I want to see how many lines of code > are in the PHP project I am working on right now. I don't know of any quick > way of doing this, and I have even thought about writing a quick PHP script > that will do it for me, but I don't want to do that if there is a bit of > shell wizardry that would be able to accomplish this for me. > > I am running Mandrake 9.0 kernel 2.4.19-16mdk, and I generally use bash, > though I have tcsh, zsh, ksh, and csh installed as well (perhaps a few > others I'm not aware of; I think I installed all the shells available in > MDK9.0) > > Thanks for any ideas! > > -Josh > > .