cancel
Showing results for 
Search instead for 
Did you mean: 

using cut command

Avery_1
Advisor

using cut command

how to use cut command to display the dates on which the files in the current directory were last modified?
hey
4 REPLIES
Jerome Henry
Honored Contributor

Re: using cut command

I suppose you are using ls -l to list them. The command then would be :
ls -l | cut -f7,8
Cut is used to show only requested fields, then we use -f option along with fields separator (if none, like here, then separator must be tab).ON ls, you get 8 fields, type(1), rights(2), links(3), prop(4), group(5), size(6), last modif(7) and name(8).
You can also use cut specifying columns, with -c, which is less clever here, but would work too with
ls-l | cut -c38- (from clumn 38 to last).
RGDS
J
You can lean only on what resists you...
Balaji N
Honored Contributor

Re: using cut command

man cut.
info cut.

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
John Meissner
Esteemed Contributor

Re: using cut command

instead of "cut" i'd recommed "awk" you can get an entire field much more easily that with cut

ll | awk '{print $6,$7,$9}'

this will show the month, day, and filename of a file
All paths lead to destiny
Sachin Patel
Honored Contributor

Re: using cut command

use awk

ls -laut | awk '{print $6 $7 $8}'

Sachin
Is photography a hobby or another way to spend $