bash script to preserve only first digits
Hello
I have a big number - i am looking for a bash script to preserve only first 3 digits of that number (basically, to have another number that consists only of first 3 digits of the original number) thanks in advance |
for example:
Code:
echo '1234567890' | cut -c1-3 |
Try using cut -b-3
Example Code:
echo "12345" | cut -b-3 |
great. thnx
|
s=1234567890; s=${s:0:3}
|
Merely in bash
Code:
number=1234567890 |
Yeah, but your answer is more complete in mentioning it only works in BaSH-like shells. BTW, how's the NuFW/Network auth project going?
|
All times are GMT -5. The time now is 09:46 AM. |