Re: sh/ksh replacement for the following bash command

2008-02-09 Thread Michael
Hi, Paul de Weerd schrieb: > | > Michael wrote: > | $ X="abcdefghi" > | $ echo $X | cut -c 1-2 > | ab > > Note that it's not a complete replacement for bash's > ${parameter:offset:length} parameter expansion implementation. If you > give it @ or an array as a parameter, behaviour is completely >

Re: sh/ksh replacement for the following bash command

2008-02-08 Thread Aner Perez
Michael wrote: Hi, I am looking for sh/ksh replacement for the following bash command: $ X="abcdefghi" $ echo ${X:0:2} ab Anyone got an idea? Michael How about this: $ echo ${X%${X#??}} ab ${X#??} is $X with the first 2 characters (??) removed. ${X%Z} is $X with Z removed from

Re: sh/ksh replacement for the following bash command

2008-02-08 Thread Christian Weisgerber
Michael <[EMAIL PROTECTED]> wrote: > I am looking for sh/ksh replacement for the following bash command: > > $ X="abcdefghi" > $ echo ${X:0:2} > ab echo ab Yes, I'm being facetious, but without context it's not clear what an appropriate "replacement" would be. Traditionally, the regular expres

Re: sh/ksh replacement for the following bash command

2008-02-08 Thread Paul de Weerd
On Fri, Feb 08, 2008 at 05:03:40PM +0100, Michael wrote: | Hi, | | Han Boetes schrieb: | > Michael wrote: | >> I am looking for sh/ksh replacement for the following bash command: | >> | >> $ X="abcdefghi" | >> $ echo ${X:0:2} | >> ab | > | > cut(1) | | Thanks a lot, sometimes the obvious solutio

Re: sh/ksh replacement for the following bash command

2008-02-08 Thread Michael
Hi, Han Boetes schrieb: > Michael wrote: >> I am looking for sh/ksh replacement for the following bash command: >> >> $ X="abcdefghi" >> $ echo ${X:0:2} >> ab > > cut(1) Thanks a lot, sometimes the obvious solutions are the hardest to find... $ X="abcdefghi" $ echo $X | cut -c 1-2 ab :-) Mic

Re: sh/ksh replacement for the following bash command

2008-02-08 Thread Han Boetes
Michael wrote: > I am looking for sh/ksh replacement for the following bash command: > > $ X="abcdefghi" > $ echo ${X:0:2} > ab cut(1) # Han