Re: Quick Bash question

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: George Toft
Date:  
To: plug-discuss
Subject: Re: Quick Bash question
Kyle Faber wrote:
>
> Howdy,
>
>         I have a real quick need for a dirty bash script which I don't forsee using
> for long.  I apologize for not doing any research, but I need to quickly know
> how to do the following and I figured one of the gurus here could help me out
> in the short term, so I can learn all about this later...

>
> I have a text file filled with entires of the following.
>
> /some/dir/foo.extension
> /some/dir/bar.extension
> /some/dir/x.extension
> etc.
>
> I would like to parse the file and generate a new text file that looks like
> this:
>
> foo
> bar
> x
> etc.
>
> The directories and the extensions are all the same.
>
> Oh and if it matters:
>
> [zoom@godzilla zoom]$ /bin/bash -version
> GNU bash, version 2.05b.0(1)-release (i686-pc-linux-gnu)
>
> Thanks a TON!!!
> --
> Kyle Faber
> Account Manager
> EMR Internet
>
> 623-581-0842 voice
> 623-582-9499 fax
>
> UNIX is a registered trademark of The Open Group in the United States and
> other countries.
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss



Since I'm bored . . .

bob@donelle:/tmp> while read FILE; do basename $FILE | cut -f1 -d.; done
< testfile
foo
bar
x
bob@donelle:/tmp> cat testfile
/some/dir/foo.extension
/some/dir/bar.extension
/some/dir/x.extension
bob@donelle:/tmp>



--
George Toft
CISSP, NCNI/NSNS, MSIS
Computer Security
AGD,llc
www.agdllc.com
623-203-1760
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss