mirror of
https://github.com/onceupon/Bash-Oneliner.git
synced 2024-12-23 16:56:35 +00:00
add variable
remove first leading zero
This commit is contained in:
parent
99b7c30807
commit
394ef7c772
@ -838,14 +838,18 @@ var="some string"
|
|||||||
echo ${#var}
|
echo ${#var}
|
||||||
# 11
|
# 11
|
||||||
```
|
```
|
||||||
|
##### replacement (e.g. remove the first leading 0 )
|
||||||
|
```bash
|
||||||
|
${var[@]#0}
|
||||||
|
```
|
||||||
|
|
||||||
##### replacement (e.g. replace 'a' with ',')
|
##### replacement (e.g. replace 'a' with ',')
|
||||||
```bash
|
```bash
|
||||||
{i/a/,}
|
{var/a/,}
|
||||||
```
|
```
|
||||||
##### replace all (e.g. replace all 'a' with ',')
|
##### replace all (e.g. replace all 'a' with ',')
|
||||||
```bash
|
```bash
|
||||||
{i//a/,}
|
{var//a/,}
|
||||||
```
|
```
|
||||||
```bash
|
```bash
|
||||||
#with grep
|
#with grep
|
||||||
|
Loading…
Reference in New Issue
Block a user