Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hussein-saad/cccat
https://github.com/hussein-saad/cccat
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/hussein-saad/cccat
- Owner: hussein-saad
- Created: 2024-08-10T14:37:38.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-10T22:29:36.000Z (3 months ago)
- Last Synced: 2024-08-10T23:32:56.873Z (3 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cccat
This project is a simple text processing tool that reads input from either standard input (stdin) or files and processes the text based on the provided arguments.
## Features
- Read text from stdin or files.
- Process text with the following options:
- `-`: Output the text as is.
- `-n`: Number all output lines.
- `-b`: Number non-empty output lines.## Usage
### Reading from stdin
To read from stdin, use one of the following commands:
```sh
node src.js -
node src.js -n
node src.js -b
```### Reading from files
To read from files, provide the file names as arguments:
```sh
node src.js file1.txt file2.txt ...
```### Examples
#### Example with stdin
```sh
echo "Hello\nWorld" | node src.js -
```Output:
```
Hello
World
``````sh
echo "Hello\n\nWorld" | node src.js -b
```Output:
```
1 Hello2 World
```#### Example with files
Assuming test.txt contains:
```
hello world
``````sh
node src.js tests/test.txt
```output:
```
hello world
```## Acknowledgements
This project was created for a coding challenge. You can learn more about it [here](https://codingchallenges.fyi/).