-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, Sep 02, 2005 at 09:00:22AM -0500, Jerry Geis wrote: > I am trying to use cut to tell me the suffix of a file. > for example: echo /home/silentm/log/file.machine.log | cut -d . -f 1- > > I was expecting to get .log or log but I get the entire string echoed back. > > doing the opposite gave me what I expected: > echo /home/silentm/log/file.machine.log | cut -d . -f 1 > gives me > /home/silentm/log/file echo /home/silentm/log/file.machine.log | sed 's/^.*\.\([^.]*\)$/\1/' Will work all the time. /home/silentm/log/file.machine.log --> log /home/silentm/log/file.machine.log.1.2.3.4 --> 4 If you want to get the dot too, just use 's/^.*\(\.[^.]*\)$/\1/' instead. Best Regards, - -- Rodrigo Barbosa <rodrigob@xxxxxxxxxxxxxxx> "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFDGJr2pdyWzQ5b5ckRAtooAKCMXfJIq55g1s8zWBL4uy7GMTBP0gCfeBQV yEAjliwB2JaXCcnZkEbVPQ8= =6CP3 -----END PGP SIGNATURE-----