I am having a variable which shows on echo like this
$ echo $var
129 148
I have to take only 129 as output.
How will I split 129 and 148?
shellstring
I am having a variable which shows on echo like this
$ echo $var
129 148
I have to take only 129 as output.
How will I split 129 and 148?
Best Answer
In addition to jasonwryan's suggestion, you can use
cut
:The above
cut
s theecho
output with a space delimiter (-d ' '
) and outputs the first field (-f1
)