https://github.com/drveles/bash_utils_c
Implementation of bash utilities: cat and grep
https://github.com/drveles/bash_utils_c
bash c
Last synced: 2 months ago
JSON representation
Implementation of bash utilities: cat and grep
- Host: GitHub
- URL: https://github.com/drveles/bash_utils_c
- Owner: drveles
- License: mit
- Created: 2024-04-01T14:30:07.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-07T16:11:59.000Z (about 2 years ago)
- Last Synced: 2025-03-05T20:56:55.651Z (over 1 year ago)
- Topics: bash, c
- Language: C
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bash Utilities
Описание проекта на русском [тут](README_RUS.md)
Implementation of basic Bash utilities in C.
## cat
Cat is one of the most commonly used commands in Unix-like operating systems.
`cat [OPTION] [FILE]...`.
### Compilation and testing
in `./src/cat` directory
`make all` - build app.
### Testing
`sh test_cat.sh` - run application tests.
### cat Options
| No. | Options | Description |
| ------ | ------ | ------ |
| 1 | -b (GNU: --number-nonblank) | numbers only non-blank lines |
| 2 | -e assumes and -v (GNU only: -E is the same, but without -v) | also displays end-of-line characters as $ |
| 3 | -n (GNU: --number) | numbers all output lines |
| 4 | -s (GNU: --squeeze-blank) | compresses multiple adjacent blank lines |
| 5 | -t assumes and -v (GNU: -T is the same but without -v) | also displays tabs as ^I |
## grep
A utility for searching files using regular expressions.
`grep [options] template [file_name]`
### Compilation
in `./src/grep` directory
`make all` - build app.
### Testing
`sh test_grep.sh` - run application tests.
### grep Options
| No. | Options | Description |
| ------ | ------ | ------ |
| 1 | -e | template |
| 2 | -i | Ignores case differences. |
| 3 | -v | Inverts the meaning of matching. |
| 4 | -c | Outputs only the number of matching strings. |
| 5 | -l | Only displays matching files. |
| 6 | -n | Precedes each line of output with the line number of the input file. |
| 7 | -h | Outputs matching lines without preceding them with file names. |
| 8 | -s | Suppresses error messages about non-existent or unreadable files. |
| 9 | -f file | Retrieves regular expressions from a file. |
| 10 | -o | Prints only matching (non-empty) parts of a matching string. |
Flags support pairwise combinations (e.g., `-iv`, `-in`).