https://github.com/samyam81/bash
Bash: A command-line shell and scripting language used for executing commands and automating tasks in Unix-like operating systems.
https://github.com/samyam81/bash
bash shell
Last synced: 2 months ago
JSON representation
Bash: A command-line shell and scripting language used for executing commands and automating tasks in Unix-like operating systems.
- Host: GitHub
- URL: https://github.com/samyam81/bash
- Owner: samyam81
- Created: 2024-05-09T08:30:38.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-20T06:58:12.000Z (about 2 years ago)
- Last Synced: 2025-07-20T08:55:10.698Z (11 months ago)
- Topics: bash, shell
- Language: Shell
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
# Text Processing Commands README
This README file provides an overview of various text processing commands and their usage in the context of `file.txt` and `words.txt`.
## 1. grep Command
The `grep` command is a powerful tool for searching patterns within text files. The following command searches for phone numbers in the format `(###) ###-####` or `###-###-####` in `file.txt`.
This command utilizes the `-E` flag to enable extended regular expressions for complex pattern matching.
## 2. sed Command
The `sed` command is used for text stream editing. The following command prints the 10th line of `file.txt`.
The `-n` option suppresses automatic printing of pattern space, and `10p` prints the 10th line.
## 3. Bash Loop
The `for` loop in Bash iterates over words in the first line of `file.txt`, printing each word on a separate line.
This loop extracts each word from the first line and prints them individually.
## 4. Text Transformation Pipeline
The following command processes the content of `words.txt` to count and display unique words with their frequencies.
- `tr -s ' ' '\n'`: Translates spaces to newlines, ensuring each word is on its own line.
- `sort`: Sorts the words alphabetically.
- `uniq -c`: Counts the occurrences of each unique word.
- `sort -r`: Sorts the words by count in descending order.
- `awk '{ print $2, $1 }'`: Prints the word followed by its count.
Feel free to modify and expand upon these commands as needed for your specific use case. If you have any questions or need further assistance, please refer to the documentation of each command or seek help from your system administrator.