1838469 Members
3115 Online
110126 Solutions
New Discussion

Re: show selected column

 
nash11
Frequent Advisor

show selected column

I want to use ll or ls to show the file info. , how can I select specify info of the file ?

for example ,

$ll ww
-rw-r--r-- 1 edp_ora edp 34 Sep 26 2005 testfile

If I only want to show the group or file only , what can I do ? thx
3 REPLIES 3
Rajeev  Shukla
Honored Contributor

Re: show selected column

do
$ll|awk '{print $9}' to see the filename
$ll|awk '{print $4}' to see the group

you can have similar combinations to view each field is represented by "$" starting from 1 to 9

spex
Honored Contributor

Re: show selected column

Hi nash11,

# ls -l | cut -f2
for file owner's group

# ls
gives filename alone.

# man cut
for more info.

PCS

spex
Honored Contributor

Re: show selected column

Should be:

# ls -l | sed 's/ */ /g' | cut -f4 -d" "

But:

# ls -l | awk '{print $4}'
# ls -l | perl -nea 'print "F[3]\n"'

are more succinct.

PCS