LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-01-2002, 09:57 AM   #1
WindozBytes
Member
 
Registered: Aug 2001
Location: CT, USA
Distribution: Mandriva 2008
Posts: 105

Rep: Reputation: 15
reverse read in KORN shell


Is there a way to read a data file ( within a korn shell ) from bottom-to-top rather than from top-to-bottom?

I'm working with some database table that have referential integrity; the tables have to be loaded in a certain order, but unloaded in the reverse order. What I'd like to be able to do is set up one data file with the table names that could be read normally for loading and in reverse order for unloading. Having one file rather than two simplifies maintenance and reduces the chance for mis-matched files.

TIA
 
Old 10-01-2002, 10:58 AM   #2
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
What format are the data files in? If they are in text format, I'm sure that you could come up with a Perl script with a reverse in it to reorder to data files.
 
Old 10-01-2002, 11:47 AM   #3
leed_25
Member
 
Registered: Jul 2002
Location: san francisco
Distribution: freebsd
Posts: 102

Rep: Reputation: 17
I don't know if this is appropriate in the KornShell --which I haven't used in many years-- but the general way to do something like this is to read the entire file into a memory array and then to walk through the array forwards or backwards as circumstances dictate.
 
Old 10-11-2002, 07:46 AM   #4
WindozBytes
Member
 
Registered: Aug 2001
Location: CT, USA
Distribution: Mandriva 2008
Posts: 105

Original Poster
Rep: Reputation: 15
leed_25:
thanks for the suggestion. KORN is extremely limited as far as array processing, but since this task is fairly simple, that turned out to be the easiest way to skin the proverbial cat
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Arrays in Korn Shell...? vous Programming 1 03-26-2005 01:35 AM
Using a Korn shell in rc scripts desbyleo Solaris / OpenSolaris 3 11-12-2004 05:27 PM
Korn shell script Muzica Solaris / OpenSolaris 4 09-06-2004 12:47 PM
install korn shell namgor Linux - Newbie 1 07-12-2004 02:52 PM
a t&t korn shell 93 shook Linux - Software 4 02-01-2003 01:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration