file reading in unix | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

file reading in unix

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-15-2005
pradeepthanraj pradeepthanraj is offline
Registered User
 
Join Date: Nov 2005
Last Activity: 16 November 2005, 7:03 AM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
file reading in unix

Hi ,
I need to read line by line from a file. Can u please tell me the most efficient way to do it. SInce i will be reading more than 1000 files in my program. i am trying the following options :
1. nawk option
nawk'{
print $0
}'files.temp

2.
filecount=`cat files.temp | wc -l`
i=1
while [ $i -le $filecount ]
do
filename=`cat files.temp | head -$i | tail -1`
#echo $filename
done

can u please tell me the best way to do this.
Sponsored Links
    #2  
Old 11-15-2005
ashterix ashterix is offline
Registered User
 
Join Date: Nov 2005
Last Activity: 14 August 2008, 3:21 AM EDT
Location: cyberjaya
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
while read filename
do
echo $filename
done < files.temp
Sponsored Links
    #3  
Old 11-15-2005
pradeepthanraj pradeepthanraj is offline
Registered User
 
Join Date: Nov 2005
Last Activity: 16 November 2005, 7:03 AM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
thnx for the solution
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Reading UNIX commands from file and redirecting output to a file rahulparo Shell Programming and Scripting 8 07-13-2011 08:09 AM
UNIX file reading vkca Shell Programming and Scripting 3 09-24-2010 11:14 AM
UNIX script for reading a file and creating another file Vijay81 UNIX for Dummies Questions & Answers 1 06-29-2009 12:13 AM
Reading lines within a Unix file. mariner UNIX for Advanced & Expert Users 5 11-18-2003 12:26 PM
Reading Particular Line From A File in Unix yeheyaansari UNIX for Advanced & Expert Users 2 02-12-2002 07:42 AM



All times are GMT -4. The time now is 04:41 AM.