ADSM-L

Re: [ADSM-L] Help with a class

2008-12-09 17:20:02
Subject: Re: [ADSM-L] Help with a class
From: Stephan Boldt <stephan.boldt+adsm-l AT GMAIL DOT COM>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Tue, 9 Dec 2008 23:16:21 +0100
Hello James,


> 3. cd to the directory called final that is located within my home
> directory.


cd ~/final

A copy of the group file called mygroup was created using the ! as the
> field separator. The fields should be separated using a : not a !.
>
> Create a single command string that will modify the file called mygroup
> and change all occurrences of the ! to a :. The command string must also
> sort the file numerically on the GID field and then save the output to a
> file called newgroup.
>

>
> A. What command string did you use?


sed -e 's/!/:/g' mygroup|sort|sort -n -k 3 -t : > newgroup

8. Consider the following alias:
>
> alias dirc 'ls -l | grep '^d' | wc -l'


>
> A. What EXACTLY will this alias do when it is executed?


It will return the number of subdirectorys of the directory from which this
command is started.


> 4. cd to the directory called final that is located within my home
> directory. Create a command string that will output the name of the
> largest file in the directory. The largest file would be the file with
> the greatest file size in bytes. The ONLY output from the command string
> should be a single file name. (80% credit if you can output a long
> listing of all of the filenames with the largest file listed at the top)
>
>
> A. What command string will do this?
>

ls -S |head --lines=1

Be aware that a subdir is treated the same way as a file. If there is no
file which is larger then an directory entry, then you get a directory name
as the result. But I guess that's correct because in Unix EVERYTHING is a
file... :)


Hope this will help you!

kind regards,
Stephan

<Prev in Thread] Current Thread [Next in Thread>