On Sun, Dec 28, 2008 at 12:00 AM, Oleg Goldshmidt <p...@goldshmidt.org>wrote:

> On Sat, Dec 27, 2008 at 10:47 PM, Erez D <erez0...@gmail.com> wrote:
> >
> >
> > On Fri, Dec 26, 2008 at 11:15 PM, Oleg Goldshmidt <p...@goldshmidt.org>
> > wrote:
> >>
> >> Well, if you insist, assuming that all the files have
> >> "<whatever>input_" in the beginning, you can use
> >> ${parameter/pattern/string} substitution, e.g., for string $foo use
> >>
> >> $ basename ${foo/*input_/} .txt
> >>
> >> Hope it helps,
> >
> > how does that extract the '000' from '<path>/input_000.txt' ?
>
> Well, "${foo/*input_/}" strips "input_" and whatever precedes it, and
> basename strips the ".txt" extension from what is left, leaving you
> with "000". I thought it was clear, sorry if it wasn't.
>

this is a solution speceific to the .txt being preceided by the 000.
(it will not work on path/input_000_xyz.txt).

i just wanted to know if i can do that in one line in bash without any
external programs (like sed )
the answer is - it can't be done. that's good enough for me, i'll use a temp
var and two lines.


thanks
erez.



>
> --
> Oleg Goldshmidt | p...@nospam.goldshmidt.org
>

Reply via email to