Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add count Command to User Space #59

Open
ajsdkty3 opened this issue Sep 9, 2024 · 2 comments
Open

Add count Command to User Space #59

ajsdkty3 opened this issue Sep 9, 2024 · 2 comments

Comments

@ajsdkty3
Copy link

ajsdkty3 commented Sep 9, 2024

Objective: Implement the count command to provide basic file content statistics.

Description:

count Command: The count command counts the number of lines, words, and characters in a specified file.

Features:

Content Statistics: Count lines, words, and characters in a file.
Options:
-l: Count lines.
-w: Count words.
-c: Count characters.
-h: Display help information on usage.
Approach: Update user space to introduce the count command. Implement functionality to read file content and calculate the number of lines, words, and characters based on command-line options. The count command will parse arguments to determine which statistics to output. If the -h argument is used, count will output simple help information and exit.

Files to be modified/added:

user:
count.c (new file for implementing the count command)
Future Development:

Enhance the command to support counting specific patterns or strings within the file.

@malensek
Copy link
Contributor

A lot of these features are already supported by the built in wc command. Maybe you can enhance it instead? man wc on a Linux machine will give you some inspiration.

@ajsdkty3
Copy link
Author

ajsdkty3 commented Sep 13, 2024

Thanks for the suggestion! I've taken your advice and enhanced the wc command:

Objective: Enhance the wc command by adding a feature to count punctuation, digits, and uppercase/lowercase letters in a file.
Description:
wc Command Enhancement: Extend the existing wc to include additional features such as counting punctuation marks, digits, and the number of uppercase and lowercase letters in a file.

Features:
Character Type Counting: In addition to counting lines, words, and characters, this enhancement will allow the user to count:
Punctuation marks (e.g., ., ,, !, ?).
Digits (0-9).
Uppercase letters (A-Z).
Lowercase letters (a-z).
Options:
-l: Count lines.
-w: Count words.
-c: Count characters.
-p: Count punctuation marks.
-d: Count digits.
-u: Count uppercase letters.
-L: Count lowercase letters.

Approach:
Modify the wc command to parse new arguments for counting punctuation (-p), digits (-d), uppercase letters (-u), and lowercase letters (-L).
Implement functionality to read the file and count these additional features along with existing lines, words, and characters.
If the -h argument is used, the wc command will display help information, including details about the new counting features.
Files to be modified/added:
user:
wc.c: Modify the existing file to include the new options and associated functions
Future Development:
Enhance the feature to allow users to count more specified symbols

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants