Being given a text file create a folder that will contain 26
dictionary files as follows:first file contains the words
begining with 'A', alphabetically sorted, the second file with
'B' and so on.

The way I tried to solve it is attached...pls help!

Hey There,

In the lab5.txt file, your script could just do "touch" to create all files instead of echoing " " into them. That way they won't have blank lines at the top.

Also, the sort calls should be redirected to other files and then copied back over the originals since sort just sends to STDOUT by default.

What kind of errors are you getting?

I'll check the exe.txt next chance I get.

Best wishes,

Mike

oh yes,

It looks like the exe.txt is being called from within the DICTION*** directory, but it's not their initially.

You could copy it down into the directory once you create and then run it, or modify it so that it knows to work on files in the DICTION*** directory instead of the current directory

, Mike

, Mike

Hey There,

If you can work out your scope (where files are when you execute them - the awk file also won't be where you expect it with the way the script is right now), your awk file will work okay, just change the each line that has

{print "$i"  >> "b.txt"}

to

{print $i  >> "b.txt"}

and it will print the words, instead of the literal $i into the files

Hope that helps :)

, Mike

hello eggi,
as far as i remember i tried that kind of print and it printed on the screen...but i'll check it soon again...

Cool,

Just remember to redirect your "sort" output from the shell script to tmp files and then copy back. That's probably what you saw on your screen. The straight-up "sort a.txt" type lines print to the screen and not into your files :)

Cheers,

Mike

:)) the printing was as u said, and the problem was where u mentioned, at sorting..thx very much
;)

Good deal :)

Glad it's working :)

, Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.