FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Need Help with Unix Commands





NewGuyinTown
For our programming assignment, we have to implement a dictionary. We have to time it and stuff like that on a Unix machine. However, I am clueless on how to use Unix commands...

Quote:

2. Timing: Run you algorithm on dictionary file dict. Time your algorithm on this input using the unix command time. For instance say time a.out <dict >anagram. Submit all the timing information (user time, system time etc) that time gives you. Also write down and submit the machine that you timed it on.

3. Correctness: Place the file anagram that is output by your program in your class directory. Also place your program and executable in your class directory. The TA will look at it if necessary.
Do not print out the output file anagram, since it is too big. Instead submit the following. Find out the number of anagram classes you found using the UNIX command wc anagram, and submit this number. Further, print all the anagram classes that contain more than 5 words in them and submit this. You will be able to do this using the UNIX command:
cat anagram | awk ’NF > 5’.


I don't understand the time a.out, cat, awk 'NF > 5'.... doesnt calling a class automatically call void main( String )? So how can there be an output?
{name here}
a.out is the standard name given to a unix application just compiled.
cat is the unix command that alphabetically organizes everything that is inputted into it. I don't know exactly what awk does, but I remember looking it up once.

Code:
cat anagram | awk ’NF > 5’.

"Categorize the file anagram, then pipe the information to awk with the parameters to print words less than 5 characters wide".

That is what I got out of it based on the information given in your post. However ./anagram might be more appropriate to execute instead of anagram because on some machines it will default to /anagram instead of ./anagram.

If you need anymore information, use the "man" command on the command line of your machine or "xman" command if you are in a desktop environment. Wikipedia should have some other info.
turbowolf
why not use "man" to get a reference for all this commands? You can use "info" if you need further information.

NewGuyinTown wrote:
For our programming assignment, we have to implement a dictionary. We have to time it and stuff like that on a Unix machine. However, I am clueless on how to use Unix commands...

Quote:

2. Timing: Run you algorithm on dictionary file dict. Time your algorithm on this input using the unix command time. For instance say time a.out <dict >anagram. Submit all the timing information (user time, system time etc) that time gives you. Also write down and submit the machine that you timed it on.

3. Correctness: Place the file anagram that is output by your program in your class directory. Also place your program and executable in your class directory. The TA will look at it if necessary.
Do not print out the output file anagram, since it is too big. Instead submit the following. Find out the number of anagram classes you found using the UNIX command wc anagram, and submit this number. Further, print all the anagram classes that contain more than 5 words in them and submit this. You will be able to do this using the UNIX command:
cat anagram | awk ’NF > 5’.


I don't understand the time a.out, cat, awk 'NF > 5'.... doesnt calling a class automatically call void main( String )? So how can there be an output?
turbowolf
awk is a GNU branch of sed.

{name here} wrote:
a.out is the standard name given to a unix application just compiled.
cat is the unix command that alphabetically organizes everything that is inputted into it. I don't know exactly what awk does, but I remember looking it up once.

Code:
cat anagram | awk ’NF > 5’.

"Categorize the file anagram, then pipe the information to awk with the parameters to print words less than 5 characters wide".

That is what I got out of it based on the information given in your post. However ./anagram might be more appropriate to execute instead of anagram because on some machines it will default to /anagram instead of ./anagram.

If you need anymore information, use the "man" command on the command line of your machine or "xman" command if you are in a desktop environment. Wikipedia should have some other info.
Related topics
The Official FriHost IRC Channel!
[PHP] Error link
Windows vs. Linux
UNIX Codes
How do I copy directories in DirectAdmin
Deltree command does not work
mail command of Unix
dual boot
Best FTP Software
UNIX and fascist logging
Backup
Android App Inventor
Best place to learn LINUX
Can you read it? (Contest reopened)
Reply to topic    Frihost Forum Index -> Computers -> Operating Systems

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.