[Wylug-help] Shell scripting
Jim Jackson
jj at comp.leeds.ac.uk
Mon May 10 09:33:30 BST 2004
On Sun, 9 May 2004, Nick Jeffery wrote:
> Hullo,
>
> I've a variable (from cat'ing a file) in a bash shell script. I'd like to
> get only the first 32 characters of the file/variable on their own..
>
> I've tried:
>
> foo=`echo ${bar:32}` but that doesn't seem to want to play ball.
>
> Anyone got an idea? Don't want to use regexps/perl/awk if at all possible.
>
from the bash manual page.....
${parameter:offset:length}
so ${bar:0:32} does it.
More information about the Wylug-help
mailing list