Brian wrote:
> Thank you all very much for your help. I should have made one thing
> clearer, though. The data file is not always numeric, some lines look
> like:
>
> 0100My name is Jim
>
>
>>strip=${six//0}
>
>
> What exactly does this line do? How do get the man page for it?
man sh or man bash
the // is a basic pattern substitution.
the basic form is
${variable/pattern/replacement}
or
${variable//pattern/replacement}
the // is the greedy form, meaning it makes the longest match possible.
when you leave off the replacement it deletes the pattern instead of
replacing it.
if you start the pattern with a # then the pattern must match to the
beginning so to work with the example above change it to
strip={$six//#0?}
this way it won't match the 00 pattern following the 1
you can use a % instead of # if you want the pattern to be at the end
Eric