Add tr command to bash cheatsheet (#1802)

Co-authored-by: Rico Sta. Cruz <rstacruz@users.noreply.github.com>
This commit is contained in:
verbatino 2022-03-13 12:08:22 +01:00 committed by GitHub
parent c84d4c1b97
commit 5a23b79e78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

22
bash.md
View File

@ -709,6 +709,28 @@ printf "This is how you print a float: %f" 2
#=> "This is how you print a float: 2.000000"
```
### Transform strings
| Command option | Description |
| ------------------ | --------------------------------------------------- |
| `-c` | Operations apply to characters not in the given set |
| `-d` | Delete characters |
| `-s` | Replaces repeated characters with single occurrence |
| `-t` | Truncates |
| `[:upper:]` | All upper case letters |
| `[:lower:]` | All lower case letters |
| `[:digit:]` | All digits |
| `[:space:]` | All whitespace |
| `[:alpha:]` | All letters |
| `[:alnum:]` | All letters and digits |
#### Example
```bash
echo "Welcome To Devhints" | tr [:lower:] [:upper:]
WELCOME TO DEVHINTS
```
### Directory of script
```bash