On Friday, October 3, 2003, at 01:45 PM, Dean Do wrote:

Hello,

Howdy.


I'm rather new to PERL.  How do I go about sorting
a simple text file using PERL?  This is what I want
to accomplish.

# sort /etc/passwd > /etc/passwd-new
# mv /etc/passwd-new /etc/passwd

Any good reason not to use the above? :)


Well, what would be the steps?

1. open /etc/passwd/
2. read all entries into memory
3. close /etc/passwd/
4. sort entries
5. open new file
6. print all entries
7. close new file
8. rename new file

Can you walk down that list replacing it with Perl statements?

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to