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
Let the player (denoted U in the diagram below) navigate around the board until she wins the game by finding the exit or is killed by a monster. A player begins the game with a sli

How to read datasets in multiple text files in an non interactive program?

2. TEST & AND TEST is like CMP, it is used for conditional statement, and doesn’t save the answer. AND is logical multiplication. 3. INS & IN IN is used for data transfer from I/O

Determine the moment of force about the point where a bracket is attached to a wall. the bracket is shown in figure attached. it extends 10 inched out from the wall and 5 inched up

The standard way for debuggers to plant interactive breakpoints in a program in RAM (whatever the processor instruction set) is to save the break pointed instruction and replace it

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

( Airline Reservations System ) A small airline has just purchased a computer for its new automated reservations system. You have been asked to develop the new system. You are to w

Prepare an XML document that contains calendar information such as the following text describes: The calendar is owned by a person (e.g. John Smith) and has a few paragraphs tha

Why no Audible support for Linux? Maybe they should use a browser interface?

Write a script called 'prob1.m' that solves for the variables y, and z in terms of a user inputed x. The variables y and z are defined as follows: y = x - 30                when