The UNIX and Linux Forums  

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
read file until certain line position finalight Shell Programming and Scripting 5 05-21-2008 12:16 AM
read the file line by line kittusri9 Shell Programming and Scripting 3 04-24-2008 05:26 AM
How to read last line of a txt file? yongho UNIX for Dummies Questions & Answers 2 06-13-2005 10:20 AM
read line from file rein Shell Programming and Scripting 5 04-14-2005 11:32 PM
How to read from a file line by line and do stuff spaceship Shell Programming and Scripting 4 03-17-2005 06:47 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-12-2005
VENC22's Avatar
Registered User
 

Join Date: Apr 2005
Posts: 15
Question Read a file line by line

I am relatively new to UNIX.
I am having a flat file with around 20,000 lines in it.
Basically, it is a dump of a database table with tab character as a delimeter.
I want to read the file row by row and process every row.

Any suggestions about achieving it efficiently??
Thanks

VEN
Reply With Quote
Forum Sponsor
  #2  
Old 05-12-2005
Registered User
 

Join Date: Jan 2005
Posts: 682
This gives you scads of ways to parse your file.
Reply With Quote
  #3  
Old 05-12-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
What do you mean by process the file?

Unix has some great text handling abilities. All of them work on a line by line basis.
Reply With Quote
  #4  
Old 10-30-2008
Registered User
 

Join Date: Mar 2008
Posts: 6
Result is not getting stored in the variable

alert_val=$( db2 "select value (( select distinct 1 from opus.alerts where alname = 'MQ_FAILURE_INTERFACE' and
aldatetime > current timestamp - 20 minutes),0) from sysibm.sysdummy1 with ur" | sed -n '/--/ {n; p;}')

Can you tell me why alert_val not able to hold the value

This is my question not the post reply

Please do not hijack other people's threads

Last edited by jim mcnamara; 10-30-2008 at 08:05 AM.
Reply With Quote
  #5  
Old 10-30-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Read line by line:
Code:
while read file_rec
do
#   file_rec is the current line of text in the file
     echo "$file_rec"
done < inputfilename  > newfilename
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
line by line

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:11 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0