I'm trying to set up a script that parses a string.
My loop is currently
while [ -n "$RAW" ]; do
// do some processing here
RAW=$(echo $RAW| sed -r 's/^.{15}//')
done
However, the script never seems to end
It is not ending because the sed expression is not correct. It expects minimum 15 characters and does not work for anything less than 15 chars. Try this:
RAW=$(echo $RAW| sed -r 's/^.{0,15}//')
Maybe you just want this:
#!/bin/bash
RAW=012345678901234567890
.
.
.
RAW=${RAW:15}
echo $RAW
567890
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With