Q

Getting a Unix feel on a PC

I am a newbie in Unix. My system's OS is Windows and I cannot install Unix on it. Can you please tell me about Unix software that works in Windows? I want this because I want to study Unix. Please send me a shell program that takes one or any number of file names as input; sorts the lines of each file in ascending order and displays the non blank lines of each sorted file and merge them as one combined sorted file. The program should...

generate an error message in case any input file does note exist.

What you are looking for is the MKS Toolkit. What this product gives you is the Unix look and feel on a PC. You have a ton of Unix commands that will work on your Windows environment. It is a mature product that has been around since the early 90s, and I recommend it highly for people who have no access to Unix machines and do not really want to install a Linux partition on their PC.

You may want to rethink your strategy, though, and get acclimated to Linux. Linux, though not Unix, can give you some exposure to Unix-type commands, and the advantage to having your own partition would be running the OS natively, with the advantage of learning a new operating system. It's also free, unlike the toolkit, so the price is right!

As far as the shell script, I'll lead you in the right direction and let you write the actual script, if that's okay. This does not have to be overly complicated.

cat file1 file2 file3 > file4

This will combine the files into a single file. Using the sort command would help you do what you need to do. Do a man-on sort for the different flags. Sort -u file4 (-u to get rid of duplicates), or some other variation should work for you. If you need to do more than simple filtering, do a man-on sed to learn more about what this powerful tool can do for you.

Good luck!


This was first published in January 2003

Dig deeper on Unix-to-Linux migration

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataCenter

SearchServerVirtualization

SearchCloudComputing

SearchEnterpriseDesktop

Close