Solved

New to UNIX

Posted on 2009-04-11
2
236 Views
Last Modified: 2013-12-16
Im trying to learn UNIX so Im starting off with a small exercise.

1. Create a directory for each week of the a month called week1, week2, week3 and week4

2. Change the working directory to week1 and create a file called budget that contains food, cable, mortgage, car each on a separate line

3. Sort this file and append the results to the same file

4. Append the results of the pwd command to the file

Im OK with doing steps 1 and 2 but Im confused on steps 3 and 4.

Any help would be great!
0
Comment
Question by:Cyber IT
2 Comments
 
LVL 4

Accepted Solution

by:
ewest02 earned 50 total points
ID: 24123016
Basically for (3) and (4)

sort file > tmp.file
cat tmp.file >> file
pwd >> file

Voila.

">"  redirects standard out to the target file ; and will create or overwrite that target
">>"  is the append operator. It will _not_ overwrite the target

  --Eric

0
 

Author Closing Comment

by:Cyber IT
ID: 31569206
That did the trick.  Thanks so much!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question