mirror of
https://github.com/sahinakkaya/til.git
synced 2024-11-22 08:39:39 +01:00
TIL: Splitting a string with delimiter
This commit is contained in:
parent
f07121706c
commit
c0c710df69
8
bash-scripting/splitting-a-string-with-delimiter.md
Normal file
8
bash-scripting/splitting-a-string-with-delimiter.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
You can split a string with `cut`:
|
||||||
|
|
||||||
|
```
|
||||||
|
foo="hello-world-bye-world"
|
||||||
|
bar=$(echo $foo | cut -d"-" -f2)
|
||||||
|
echo $bar
|
||||||
|
# world
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user