Solved

New to UNIX

Posted on 2009-04-11
2
221 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now