[CentOS] question on cut

Jeff Stacey Jeff.Stacey at jri.ca
Fri Sep 2 14:16:47 UTC 2005

you would need to use

echo /home/silentm/log/file.machine.log | cut -d . -f3

echo /home/silentm/log/file.machine.log | cut -d . -f1   *->  /home/silentm/log/file
echo /home/silentm/log/file.machine.log | cut -d . -f2   *->  machine
echo /home/silentm/log/file.machine.log | cut -d . -f3   *->  log

- Jeff

>>> geisj at pagestation.com 9/2/2005 9:00 AM >>>
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

I am trying to find a way to test if the file ends in .log?

How might I do that.



CentOS mailing list
CentOS at centos.org 

More information about the CentOS mailing list