Simple Bash script question for a noob
I have a variable that contains: "m;0;1386036965;3;8;135;202;1"
I want to extract out of that a variable that contains the number after the 4th ";". I know this is simple but I'm just lost. In this case the 8. Thanks |
Code:
The above is an easy way to do it, you could look into awk or sed to make it cleaner. -d sets your delimiter and -f selects which field. So the fourth field seperated by a ';' |
echo "m;0;1386036965;3;8;135;202;1" | cut -d';' -f5
|
Quote:
|
Code:
$ awk -F";" '{print $5}' #press enter here |
Quote:
|
All times are GMT -5. The time now is 06:23 AM. |