sed help

Walter J. Mack wmack at componentsw.com
Wed Apr 2 11:08:46 MST 2008


Hope this works better...

ls -l | awk '{print $8}' | grep -e 's/\....$//'

I presume the awk does what it is supposed to

grep -e still needs the s/from/to/
\. should match the . literally. (You might have to do a "\\." - not 
sure without trying. If you use bash, insert a set -x before the line to 
see what the shell does with the escaping)
the $ will match the end of the string, so if you have a file that is 
all.tar.bz2, it would leave the all.tar and get rid of the .bz2

Kevin Faulkner wrote:
> I'm sorry its too hard to read your email, turn off HTML email in Thunderbird by
> going to account settings > then select your mailbox then "uncheck" compose HTML
> email. 
>
> As for using cut, that might work I had not really thought about that. I'll play
> around with it and let ya'll know.
>
> I am familiar with Perl, and I know that it won't work in my situation. sed and
> awk will still be around for years to come, and they are still very practical.
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
>
>   



More information about the PLUG-discuss mailing list