Need help in GNU Linux programming

I'm an absolute beginner in UNIX/Linux programming.

I have to solve the following problem:

I should write an ls.awk (awk) program, which generates the following analysis from the output of command ls-l:

- It only examines the files which belong to the "root" user.
- It writes the owner's group of the examined files.
- At the end of the list it writes the number of the examined regular files and the sum of those ones' sizes in the following form:

regular files, total size:

where means the number of the regular files, means the size of the regular files.

- Nothing else can appear in the output.

For example: for the following input:

total 861
-rwxr-xr-x 1 bin bin 16 Aug 25 2000 ultrix_path
-rwxr-xr-x 1 bin bin 1465 Aug 25 2000 ultrix_profile
drwxr-xr-x 2 root system 8192 Aug 1 2001 uucp
-rwxr-xr-x 1 uucp uucp 2465 Aug 1 2001 uugettydefs
-rw-r--r-- 1 root system 130 Oct 20 09:08 vdumpdates
drwxr-xr-x 3 bin bin 8192 Jan 1 1970 vol
drwxr-xr-x 2 root system 8192 Apr 4 2002 xmodmap
lrwxrwxrwx 1 root system 9 Sep 2 14:55 yp -> ../var/yp
-rw-r--r-- 1 root system 1400 Sep 11 2001 ypserv.conf
drwxr-xr-x 20 root system 8192 Sep 2 15:07 zoneinfo

ls.awk generates the following output:

2 regular files, total size: 1530

And I have to write this program as an interpreter file using the awk GNU version (gawk). The solutions have to be put in an ls.awk file.

Please, help me.

Thans in advance.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!