The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
reading ps command's output line by line s. murat Shell Programming and Scripting 5 05-22-2008 04:23 AM
Reading the particular line from the file eamani_sun Shell Programming and Scripting 3 05-16-2008 04:55 PM
reading text file line by line MizzGail Shell Programming and Scripting 6 04-14-2008 06:58 AM
Line by line file reading... and more! ProFiction Shell Programming and Scripting 6 07-26-2007 11:32 AM
Reading line by line from a file tej.buch Shell Programming and Scripting 2 01-23-2006 02:50 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-30-2001
akpopa akpopa is offline
Registered User
  
 

Join Date: Aug 2001
Location: South Carolina
Posts: 18
Reading line by line from file.

Hi,

I am trying to do the following in a ksh script:

Loop until (eof)

in_line = current input line from file

Statements.

end loop.



But have been having trouble finding syntax and such for scripting in this language. Could some one point me in the right direction? I would especially like to know about good, free, online reference material.

Thanks,

Amber Taylor
  #2 (permalink)  
Old 08-30-2001
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
I would use something like this:
Code:
#! /usr/bin/ksh
exec < inputfile

while read in_line ; do
     echo line = $in_line
done
  #3 (permalink)  
Old 08-30-2001
akpopa akpopa is offline
Registered User
  
 

Join Date: Aug 2001
Location: South Carolina
Posts: 18
Thank you for your help. Do you know where to find any kind of online reference for working on ksh files?

Thanks,

Amber Taylor
  #4 (permalink)  
Old 08-30-2001
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
you could also use a for loop.

Code:
for i in `cat filename`;do
processing.....
done
$i will = each line in the file.

Books: oreilly.com has a book called "Learning the Korn Shell" another great book.
  #5 (permalink)  
Old 08-30-2001
akpopa akpopa is offline
Registered User
  
 

Join Date: Aug 2001
Location: South Carolina
Posts: 18
Thank you, especially for the reference.

Thanks,

Amber Taylor
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:54 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0