WC(1) General Commands Manual WC(1)NAME
wc - word count
SYNOPSIS
wc [ -lwc ] [ name ... ]
DESCRIPTION
Wc counts lines, words and characters in the named files, or in the standard input if no name appears. A word is a maximal string of char-
acters delimited by spaces, tabs or newlines.
If the optional argument is present, just the specified counts (lines, words or characters) are selected by the letters l, w, or c.
WC(1)
Check Out this Related Man Page
WC(1) BSD General Commands Manual WC(1)NAME
wc -- word, line, and byte count
SYNOPSIS
wc [-c | -m] [-Llw] [file ...]
DESCRIPTION
The wc utility displays the number of lines, words, bytes and characters contained in each input file (or standard input, by default) to the
standard output. A line is defined as a string of characters delimited by a <newline> character, and a word is defined as a string of char-
acters delimited by white space characters. White space characters are the set of characters for which the iswspace(3) function returns
true. If more than one input file is specified, a line of cumulative counts for all the files is displayed on a separate line after the out-
put for the last file.
The following options are available:
-c The number of bytes in each input file is written to the standard output.
-L The number of characters in the longest line of each input file is written to the standard output.
-l The number of lines in each input file is written to the standard output.
-m The number of characters in each input file is written to the standard output.
-w The number of words in each input file is written to the standard output.
When an option is specified, wc only reports the information requested by that option. The default action is equivalent to all the flags
-clw having been specified.
The following operands are available:
file A pathname of an input file.
If no file names are specified, the standard input is used and no file name is displayed.
By default, the standard output contains a line for each input file of the form:
lines words bytes file_name
EXIT STATUS
The wc utility exits 0 on success, and >0 if an error occurs.
SEE ALSO iswspace(3)COMPATIBILITY
Historically, the wc utility was documented to define a word as a ``maximal string of characters delimited by <space>, <tab> or <newline>
characters''. The implementation, however, didn't handle non-printing characters correctly so that `` ^D^E '' counted as 6 spaces, while
``foo^D^Ebar'' counted as 8 characters. 4BSD systems after 4.3BSD modified the implementation to be consistent with the documentation. This
implementation defines a ``word'' in terms of the iswspace(3) function, as required by IEEE Std 1003.2 (``POSIX.2'').
The -L option is a non-standard extension, compatible with the -L option of the GNU and FreeBSD wc utilities.
STANDARDS
The wc utility conforms to IEEE Std 1003.2-1992 (``POSIX.2'').
BSD February 18, 2010 BSD
I had received a complaint recently that 'wc' is not returning a correct byte count for large files (in 10s of GB). Does 'wc' have any such limitation? If yes, would 'ls' be a better option to fetch file size.
I am planning on replacing wc with ls for calculating file sizes in the existing code.... (13 Replies)
Hey my friend was asking me if i knew a way to cout how many different words in a file. I told him no not off hand, but i was thinking about it, and i started to wonder also. I imagine this is probably pretty simple im just missing something, I keep confusing my self with how you would compair and... (16 Replies)
Hi,
This might be a very basic question but i am begineer with UNIX. The output of wc -l gives the line count along with the filename.
$ wc -l compare_output.dat > test.dat
$ more test.dat
10 compare_output.dat
I just want the digit 10 in this sceniro. Can anyone plez help me on... (15 Replies)
Hi all i have a syntax , Can some one please give me a script
1, I need to check and execute the command.
ps -ef | grep java | wc -l
5
Output should me 5
if not have to run the command:
ps -ef | grep java
the following java process... (11 Replies)
Hi there,
I'd like to find a way to display a string and count the words in it.
supernova:~# echo 'hello world' | tee - | wc
Unfortunately, this doesn't work.
Any idea?
Thanks in advance.
Santiago (15 Replies)
Hi all,
I need to count the number of lines in all the files under a directory (several levels deep). I am feeling extremely dumb, but I don't know how to do that. Needless to say, I am not a shell script wiz... Any advice?
thanks in advance! (13 Replies)
Hi guys!
I need to cut first row from a file (using awk) without the record separator character (in my case its MS-DOS 0D0A) and field separator character (in my case ; 3B) and put it in another file.
Can you help with that?
Regards,
PsmakR (18 Replies)
Hi techies ..
This is my first posting hr ..
Am facing a serious performance problem in counting the number of lines in the file. The input files i get will be in some 10 to 15 Gb of size or even sometimes more ..and I will load it to db
I have used wc -l to confirm whether the loader... (14 Replies)
I have to create a Perl script which will transpose the data output from my experiment, from columns to rows, in order for me to analyse the data.
I am a complete Perl novice so any help would be greatly appreciated.
The data as it stands looks like this:
Subject Condition Fp1 ... (12 Replies)
Hi, I am facing issue with cut and wc. here is the sample.
the data in file -
tail -1 05_19_BT_TBL_LOAD_20120524064242.bad|cut -c9-58
WatsSaver - AGGREGATED PLAN1581 CALLS FOR 2872.6
tail -1 05_19_BT_TBL_LOAD_20120524064242.bad|cut -c9-58|wc -c
51
tail -1... (12 Replies)
Hey All,
Quick question...
I'm writing a short script to check if a continuous port is running on a server.
I'm using "ps -ef | grep -v grep | grep processName" and I was wondering if it was better/more reliable to just check the
return code from the command or if its better to pipe to... (12 Replies)
Hallo Friends,
I have +/- 800K files that i need to go through. The files have extention .csv
The script that i need should read field number 14 and if field number 14 is equal to 6010 or 2345 or 5690 or 8670 or 4567 then i need to know the total count.
... (17 Replies)
On AIX When I Run the commands below I get -
cat tt11.ksh
#!/bin/ksh
ps -eaf |grep tt11.ksh|grep -v grep|wc -l
count=`ps -eaf |grep tt11.ksh|grep -v grep|wc -l`
echo "value of count is $count"
Output (what I expected)
./tt11.ksh
1
value of count is 1
When I Run... (12 Replies)
Im repeating same command to get count, filename from 4 different files, writing to one same file.
awk 'END{print NR"|"FILENAME}' file.txt >> temp.txt;
awk 'END{print NR"|"FILENAME}' asdf.txt >> temp.txt;
awk 'END{print NR"|"FILENAME}' lkjh.txt >> temp.txt;
awk 'END{print NR"|"FILENAME}'... (12 Replies)
I have a directory of files, I can show the number of lines in each file and order them from lowest to highest with:
wc -l *|sort
15263 Image.txt
16401 reference.txt
40459 richtexteditor.txt
How can I also print the number of unique lines in each file?
15263 1401 Image.txt
16401... (15 Replies)