mirror of
				https://github.com/onceupon/Bash-Oneliner.git
				synced 2025-11-03 22:51:07 +01:00 
			
		
		
		
	add variable
remove first leading zero
This commit is contained in:
		@@ -838,14 +838,18 @@ var="some string"
 | 
			
		||||
echo ${#var}  
 | 
			
		||||
# 11
 | 
			
		||||
```
 | 
			
		||||
##### replacement (e.g. remove the first leading 0 )
 | 
			
		||||
```bash
 | 
			
		||||
${var[@]#0}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
##### replacement (e.g. replace 'a' with ',')
 | 
			
		||||
```bash
 | 
			
		||||
{i/a/,}
 | 
			
		||||
{var/a/,}
 | 
			
		||||
```
 | 
			
		||||
##### replace all (e.g. replace all 'a' with ',')
 | 
			
		||||
```bash
 | 
			
		||||
{i//a/,}
 | 
			
		||||
{var//a/,}
 | 
			
		||||
```
 | 
			
		||||
```bash
 | 
			
		||||
#with grep
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user