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
A hardware store sells the following hardware tools: screwdriver, wrench, and tape measure. You are asked to calculate the profit for the store based on the number of tools sold an

What are the string data transfer instruction in assembly language? Explain all types of string data transfer instructions with examples of each? What will be the behavior of direc

program the following exercises using JAVA and JENA API: SPARQL endpoint to be queried: QUERY:">http://services.data.gov.uk/education/sparql QUERY: What are the school’s names th

Explain the Comma Operator- Computer Programming? The comma has two utilization and the most common use is as a parameter separator for data types and function parameter lists. H

Question: (i) What is multithreaded programming? Lists the benefits achieved by multithreading your code in a program. (ii) What type of coding should be eliminated when d

Write a script called 'prob3.m' that does the same thing as the previous question except that it makes use of a switch-case construct instead of an if-else. In the file 'hw4.m'

Implement the Prim's algorithm with array data structure as described in slide 12 of the file 04mst.ppt. Your program should have a runtime complexity of O(n2) and should be as eff

We want to create a structure that will represent a deck of cards (not necessarily full). Each card has a character (between '2' to '9' and 'T', 'J', 'Q', 'K', 'A') and a suit (dia

Computers and Programming Concept 1. Classify computer systems according to capacity. How they are different from computers according to the classification of technology. Provi

You are asked to develop a replicator (client) that distributes a large job over a number of computers (a server group) on a single switched LAN (our BU04 lab). In this assignment,