Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

New to UNIX

Posted on 2009-04-11
2
Medium Priority
?
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
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 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…
Suggested Courses

715 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