
please wait
file1.txt 71 431 file2.bash 31 511 |
|
|
wc: ls: No such file or directory 73 abc.txt 5 cin.bash 43 formula 6 chem 127 total wc: ls: No such file or directory 421 abc.txt 12 cin.bash 136 formula 24 chem 593 total |
EXPANSION Expansion is performed on the command line after it has been split into words. There are seven kinds of expansion performed: brace expansion, tilde expansion, parameter and vari- able expansion, command substitution, arithmetic expansion, word splitting, and pathname expansion. Pathname Expansion After word splitting, unless the -f option has been set, bash scans each word for the characters *, ?, and [. If one of these characters appears, then the word is regarded as a pattern, and replaced with an alphabetically sorted list of file names matching the pattern. |
NAME wc - print newline, word, and byte counts for each file SYNOPSIS wc [OPTION]... [FILE]... |
wc *
the wc never sees the *, unless bash fails to expand the word. What wc does see, is filenames. Note though that subdirectorynames are included.for F in * ; do [[ -f "$F" ]] && wc -lw "$F"; done |
|
|
wc -lw foo.txt | sed "s/ *\([^ ]\+\) *\([^ ]\+\) \(.*\)/\3 \t\2 \t\1/" |
Hi, I'm trying to print all the name of the files in the working directory as well as the number of lines and words that each file has next to them i.e |
file1.txt 71 431 file2.bash 31 511 |
|
|