Skip to content

dev-xero/wc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WC

wc is a Unix utility tool that prints the number of lines, words or bytes in a text file. This is a relatively straight forward implementation of the tool in pure C.

Compiling

You can compile the source file using gcc (GCC needs to be installed).

mkdir -p ./build
gcc -o ./build/wc ./wc.c

Alternatively, you can batch execute the commands if you have make installed.

make build

Usage

wc expects an optional flag and filepath argument.

./build/wc [-FLAG] [FILEPATH]

Example

./build/wc test.txt

7145 58164 342190 test.txt

Flags

1. -c: Prints the byte count.

Example:

./build/wc -c test.txt

342190 test.txt

2. -l: Prints the line count.

Example:

./build/wc -l test.txt

7145 test.txt

3. -w: Prints the word count.

Example:

./build/wc -w test.txt

58164 test.txt

4. -m: Prints the UTF-8 character count.

Example:

./build/wc -m test.txt

 339292 test.txt

About

A relatively straight forward implementation of the wc Unix utility tool written in C.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published