Display files specified in directory in format, Programming Languages



 W.A.S.S to display all the files in a specified directory in the following format:

File  size in K        Date   Protection    Owner


Program


echo -e "Enter dir : \c"

read dirc

ls -al $dirc > list.tmp

wc -l list.tmp  > rec.tmp

norec=`awk '{print $1}' rec.tmp`

echo "REC=$norec"

count=2

echo "FILE    SIZE IN K   DATE    PROTECTION   OWNER  " > list2.tmp

echo "---------------------------------------------------" >> list2.tmp

while [ $count -le $norec ]

do

        head -$count list.tmp > list1.tmp

 

        tail -1 list1.tmp | awk '{printf "%-20s %-10d %15s %-15s %5s\n",$8,$5,$6,$1,$3}' >> list2.tmp

        count=`expr $count + 1`

 

done

cat list2.tmp

 

OUTPUT

 

$   sh e6vax.sh

Enter dir : tmp

REC=7

FILE    SIZE IN K                            DATE    PROTECTION   OWNER

-----------------------------------------------------------------------------

.                    1024               2006-11-10 drwxr-xr-x      linux

..                   1024               2006-11-10 drwxr-xr-x      linux

shv                0                     2006-11-10 -rw-r--r--       linux

j2me              0                    2006-11-10 -rw-r--r--       linux

anaconda       14                  2006-11-10 -rw-r--r--       linux
temp1            1024              2006-11-10 drwxr-xr-x      linux

Posted Date: 9/26/2012 8:45:00 AM | Location : United States







Related Discussions:- Display files specified in directory in format, Assignment Help, Ask Question on Display files specified in directory in format, Get Answer, Expert's Help, Display files specified in directory in format Discussions

Write discussion on Display files specified in directory in format
Your posts are moderated
Related Questions
i doing a project about depth estimation, i have done some research, and i used the block matching algorithm to get the motion vectors from the image sequences, i now have the prob

how to store an url in a dartabase(sql server 2005)? (or) create table b(url what is the datatype for url?

Write a program to calculate amount after n number of years by inputting principal at the rate of 8% interest.

What are the Functions in Computer Programming? A program is completed up of one or more functions, with one of these being main(). Function is a self-contained block of progra

(a) (i) What do you meant  by a function? Are functions required when writing a C program? (ii) State one of the advantages to the use of functions. (iii) What do you meant by a

Objectives: Create an applet, Use methods from the Graphics class , Use the Color class General Instructions: The java class that need to be imported into this assignm

I need an efficient and fast reverse engineer with good knowledge of assembly x86 language, strong reverse engineering skills, IDA Pro (Hex-Rays) to Linux game routine, C, C++ prog

Write a program to handle a book collection. The data on each book might be title, author, publication date, book number and  cataloging details. Allow for adding or deleting books

how to make a program using vb?seriously i don''t know

Write a Perl script that prints the contents of a file Write a Perl script that prints the contents of a file, prefixing each line with a line number. The script should acc