HELP ASAP.. pretty simple..


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers HELP ASAP.. pretty simple..
# 1  
Old 09-29-2004
Question HELP ASAP.. pretty simple..

Hey guys....

couple questions...

I am working a problem set and can't answer this:

1) Suppose you are in a directory that contains a file called "foo." You want to create a new file called "bar" that contains the sorted contents of "foo" in the parent directory of the one you're in. How would you do it with one command?

2) Most (but by no means all) of the programs on klotho are in "/usr/bin". The "ls" command, by itself, can't tell you how many programs are in that directory, but there's a clever way to get that information by combining "ls" with another command. Can you figure it out?

3) How, using UNIX, would you determine what day November 9th, 1066 fell on?

Thanks in advance.. this is due in a few hours... so urgent
# 2  
Old 09-29-2004
From the rules

(6) Do not post classroom or homework problems.
# 3  
Old 09-29-2004
These are exercises which are integral to my learning unix... i'm stuck and would like to figure these out... Thanks :-)
# 4  
Old 09-29-2004
In that case, post what you have got so far.

What work have you done to solve the problems yourself?

Have you searched these forums to see if people have already answered these questions?

Have you searched http://www.google.com?

Have you searched the man pages (using the apropos command to search the short descriptions)?

People will not be willing to serve you up "answers on a plate"

Cheers
ZB
# 5  
Old 09-29-2004
yes

yes... have been working diligently and these are 3 of 20 i was unable to solve (just figured out the calendar question)...

as far as question 1 goes....

i've tried the following but have gotten confused as to how to create a file to the parent directory in one move..

this is what i attempted to no avail...

sort foo > .. bar was a feeble attempt but have exhausted myself searching for similar issues on google..

best regards
# 6  
Old 09-29-2004
Computer #2

on number 2 i don't mind telling you i am completely lost here..

while seaching with the man function i think i need to somehow use wc along with ls but not sure exactly how to do so..

any help would be most appreciated..
# 7  
Old 09-29-2004
Well, I'm not sure that the moderators would agree, but it looks like you have been trying hard to solve the problems.

You are also very close on both counts.

For your first question - try "sort foo > ../bar" - as I say - you were very close

For your second question, you are correct that you need wc. Something like
"ls -1 /usr/bin | wc -l". (That's ls minus ONE and wc minus ELL)

I'd suggest that you start studying pipes and redirection, as these are fundamental concepts when working with the UNIX command line.

If the mods want to lock/delete this thread, fair enough, but I think the OP had done most of the work anyway.


Cheers
ZB
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. What is on Your Mind?

Pretty kool datacentre

Hi All, Just seen this news article on the BBC website. Microsoft sinks data centre off Orkney - BBC News Instead of investing in new cooler processor technology they decide to warm the ocean with the old. Okay, it's just an experiment. Interesting? (2 Replies)
Discussion started by: hicksd8
2 Replies

2. UNIX for Dummies Questions & Answers

Xmllint pretty print, batch files

I have about 20 xml files I want to use xmllint to pretty print: xmllint --format file01.xml > pretty_file01.xml xmllint --format file02.xml > pretty_file02.xml etc Is there a way I can just use "xmllint --format" on all the current xml files so I don't have to run this command 20 times?? :( (5 Replies)
Discussion started by: pxalpine
5 Replies

3. UNIX and Linux Applications

Organize (pretty) code

I'm looking for terminal programs, which organize and pretty code like HTML or JavaScript. Thanks! ---------- Post updated at 07:01 AM ---------- Previous update was at 01:49 AM ---------- Found this Online javascript beautifier (1 Reply)
Discussion started by: borobudur
1 Replies

4. Shell Programming and Scripting

Regarding passwd command - Pretty urgent

Can any one please help me for the following :mad: i'm searching for an alternative command in linux for passwd -as (which is in solaris) but in linux there is an option "-S" which gives the status of only one user for listing all the user i cudn't find any alternative this "passwd -as" in... (0 Replies)
Discussion started by: sabee.prakash
0 Replies

5. UNIX for Dummies Questions & Answers

My output doesn't match anything...and the program is pretty simple

This is what I have: #include <stdio.h> int main (void) { int integerVar; int floatingVar; int doubleVar; int charVar; integerVar = 100; floatingVar = 331.79; doubleVar = 8.44e+11; charVar = 'W'; _Bool boolVar; boolVar = 0; ... (3 Replies)
Discussion started by: pwanda
3 Replies

6. Programming

I am pretty new to this

Ok, so I need to make a program using PICO. Here is the assignment, if anyone knows how to do this please show me. Thanks. Acme Paints, a well-respected local paint store, is having their big End-Of-Winter Paint Sale. They have way too much red, green, yellow, and blue paint on hand in their... (1 Reply)
Discussion started by: thescene
1 Replies

7. UNIX for Dummies Questions & Answers

all the pretty scripts gone...gone...

I managed to delete my first shell script which was a menu that called functions. I made it all real nice and it ran like a winner. I was so pleased with it I wanted to print it out and look it over, over lunch. Well, lets just say Im better at scripting than just regular commands coz I deleted... (2 Replies)
Discussion started by: michelle
2 Replies

8. AIX

pretty good aix doc if you are unfamilar with it

http://homepage.virgin.net/johnc.king/files/aixdoc/aixdoc.pdf this is taken from http://watkiss.members.easyspace.com/computers/unix/aix/aixdoc.html it is 372 pages long. (0 Replies)
Discussion started by: Optimus_P
0 Replies
Login or Register to Ask a Question