Robert:
How about this one:
[EMAIL PROTECTED]:~$ cat filename
foo.bar.txt
joe.bar.junk
www.big.bad.bar.goo
------ awk's NF var is Number of fields ---
------ this would always spit out the second to the last field. ---
[EMAIL PROTECTED]:~$ cat filename | \
> while read FILE
> do
> echo $FILE | awk -F'.' '{print $(NF-1)}'
> done
bar
bar
bar
Cheers;
E!
>
> Anyone have an alternate way to parse an environment variable?
>
> I have a filename in an environment variable that I'd like to parse.
> The filename is of the form "foo.bar.txt" and I'd like to parse out
> "bar". This is the solution I'm currently using:
>
> file=foo.bar.txt
> file=${file%.txt}
> file=${file#foo.}
>
> Any other solutions?
>
> Regards,
> - Robert
> http://www.cwelug.org/downloads
> Help others get OpenSource software. Distribute FLOSS
> for Windows, Linux, *BSD, and MacOS X with BitTorrent
>
>
> _______________________________________________
> CWE-LUG mailing list
> [email protected]
> http://www.cwelug.org/
> http://www.cwelug.org/archives/
> http://www.cwelug.org/mailinglist/
>
>
>
_______________________________________________
CWE-LUG mailing list
[email protected]
http://www.cwelug.org/
http://www.cwelug.org/archives/
http://www.cwelug.org/mailinglist/