question on cut

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 09/02/2005 04:00 PM, 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
> 
> I am trying to find a way to test if the file ends in .log?
> 
> How might I do that.

If you really want to >cut< .log you could use
basename /home/silentm/log/file.machine.log .log.

Best,
  Oliver

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux