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 > Shell Programming and Scripting
.
google unix.com



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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
reading from a file and pass as variables and ignore # in the file konark Shell Programming and Scripting 4 11-08-2007 03:55 AM
reading unix file system from windows cneill Filesystems, Disks and Memory 0 02-06-2007 01:21 PM
Reading file names from a file and executing the relative file from shell script anushilrai Shell Programming and Scripting 4 03-10-2006 05:25 AM
Reading lines within a Unix file. mariner UNIX for Advanced & Expert Users 5 11-18-2003 01:26 PM
Reading Particular Line From A File in Unix yeheyaansari UNIX for Advanced & Expert Users 2 02-12-2002 08:42 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-15-2005
pradeepthanraj pradeepthanraj is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 3
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.
  #2 (permalink)  
Old 11-15-2005
ashterix ashterix is offline
Registered User
  
 

Join Date: Nov 2005
Location: cyberjaya
Posts: 85
while read filename
do
echo $filename
done < files.temp
  #3 (permalink)  
Old 11-15-2005
pradeepthanraj pradeepthanraj is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 3
thnx for the solution
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 08:20 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