Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

New to UNIX

Posted on 2009-04-11
2
Medium Priority
?
256 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 200 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

916 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