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) User Commands wc(1)NAME
wc - display a count of lines, words and characters in a file
SYNOPSIS
wc [-c | -m | -C] [-lw] [file...]
DESCRIPTION
The wc utility reads one or more input files and, by default, writes the number of newline characters, words and bytes contained in each
input file to the standard output.
The utility also writes a total count for all named files, if more than one input file is specified.
wc considers a word to be a non-zero-length string of characters delimited by white space (for example, SPACE, TAB). See iswspace(3C) or
isspace(3C).
OPTIONS
The following options are supported:
-c Counts bytes.
-C Same as -m.
-l Counts lines.
-m Counts characters.
-w Counts words delimited by white space characters or new line characters. Delimiting characters are Extended Unix Code (EUC) char-
acters from any code set defined by iswspace().
If no option is specified, the default is -lwc (counts lines, words, and bytes.)
OPERANDS
The following operand is supported:
file A path name of an input file. If no file operands are specified, the standard input will be used.
USAGE
See largefile(5) for the description of the behavior of wc when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes).
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of wc: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO cksum(1), isspace(3C), iswalpha(3C), iswspace(3C), setlocale(3C), attributes(5), environ(5), largefile(5), standards(5)SunOS 5.10 20 Dec 1996 wc(1)
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)