https://github.com/freedomben/tool-in-awk
A quick demo of using Awk in place of easier-to-use unix tools
https://github.com/freedomben/tool-in-awk
Last synced: 4 months ago
JSON representation
A quick demo of using Awk in place of easier-to-use unix tools
- Host: GitHub
- URL: https://github.com/freedomben/tool-in-awk
- Owner: FreedomBen
- Created: 2020-04-20T20:31:50.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-20T20:34:46.000Z (about 6 years ago)
- Last Synced: 2025-07-04T16:16:41.566Z (11 months ago)
- Size: 0 Bytes
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tool-in-awk
You don't need `` because you can use `awk`!
## cat
Still using `cat` when `awk` is so much more 1337?
Instead of:
```bash
cat *.txt
```
Use:
```bash
awk '{ print }' *.txt
```
## grep
Instead of:
```bash
grep -E '' *.txt
# or
some_command | grep -E ''
```
Use:
```bash
awk '//' *.txt
# or
some_command | awk '//'
```
## sed
Instead of:
```bash
sed -E 's//your replacment/g' *.txt
# or
some_command | sed -E 's//your replacment/g' *.txt
```
Use:
```bash
awk '{ gsub(/command/, "shamand"); print }' *.txt
# or
some_command | awk '{ gsub(/command/, "shamand"); print }'
```
## wc
Instead of:
```bash
wc myfile.txt
```
Use:
```bash
awk '{ w += NF; c += length + 1 }; END {print NR, w, c, FILENAME }' myfile.txt
```
Way easier!
## Conclusion
Use the best tool for the job, and in every possible case, that best tool is `awk`.