Re: extract chars after a last dot
From: stephan beal (stephan_at_wanderinghorse.net)
Date: 08/04/03
- Next message: Stu: "ksh using getopt command"
- Previous message: Jens Schweikhardt: "Re: extract chars after a last dot"
- In reply to: mike: "extract chars after a last dot"
- Next in thread: Ed Morton: "Re: extract chars after a last dot"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 04 Aug 2003 16:26:34 +0200
mike wrote:
> hi
>
> i have files with names test.1 and test.file.10
> how do i extract the characters after the last dot? so in the example
> it would be
>
> 1) test.1 extract to "1"
> 2) test.file.10 extract to "10"
If you use bash, you can do this:
stephan@cheyenne:~/> export foo=one.two.three
stephan@cheyenne:~/> echo ${foo##*.}
three
loop over a set of files with:
for i in *.*; do ext=${i##*.}; echo $ext; done
-- ----- stephan beal Registered Linux User #71917 http://counter.li.org I speak for myself, not my employer. Contents may be hot. Slippery when wet. Reading disclaimers makes you go blind. Writing them is worse. You have been Warned.
- Next message: Stu: "ksh using getopt command"
- Previous message: Jens Schweikhardt: "Re: extract chars after a last dot"
- In reply to: mike: "extract chars after a last dot"
- Next in thread: Ed Morton: "Re: extract chars after a last dot"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
Loading