Re: sed help

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kevin Faulkner
Date:  
To: Main PLUG discussion list
Subject: Re: sed help
On Wed, Apr 02, 2008 at 11:08:46AM -0700, Walter J. Mack wrote:
> 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/

I didn't know that grep could switch text, I thought for sure that was sed that
switches text. Even then I'm not trying to switch text instead I am trying to
get it to print, which is why I'm using /p in sed.

> \. 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

ls -l|awk '{print $8}'|grep -e "\....$" will print all files that have an
extension.
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss