linux - Cutting the column including size -
i want cut column include size of files . use ls -l
view info files in current localization . save info file in txt file ls -l > info.txt
, , want cut column including size . cat info.txt | cut -d'' -f6
don't work . wrong ?
this include info.txt :
-rwx------ 1 s10891 domain users 2188 may 4 14:51 info.txt -rwx------ 1 s10891 domain users 1640 mar 10 07:43 code.txt -rwx------ 1 s10891 domain users 68 mar 4 11:59 sorted.txt drwx------ 1 s10891 domain users 0 jan 11 09:48 ppj drwx------ 1 s10891 domain users 0 sep 7 2012 public_html drwx------ 1 s10891 domain users 0 apr 15 11:16 rbd drwx------ 1 s10891 domain users 0 jan 7 09:45 rdb drwx------ 1 s10891 domain users 0 apr 15 12:00 sop drwx------ 1 s10891 domain users 0 apr 8 12:53 sop_ex3 -rwx------ 1 s10891 domain users 122 feb 25 11:48 sop_info.txt drwx------ 1 s10891 domain users 0 jan 14 09:41 windowsformsapplicati drwx------ 1 s10891 domain users 0 jan 14 09:41 windowsformsapplicati drwx------ 1 s10891 domain users 0 jan 14 09:41 windowsformsapplicati
and want :
2188 1640 68 0 0 0 0 0 0 122 0 0 0
most cut
s count literal characters, -f 6
work, data has in same columns. not sure if 3rd last line typo or exact reproduction of output, illustrates problem cut perfectly.
for case, people use awk
solution:
ls -l | awk '{print $6}'
will produce output have listed
the beauty of awk field 6 determined value of awk fs variable (field separator), defaults "multiple white space values" (space or tab) (this not exact description, close enough needs).
Comments
Post a Comment