The UNIX and Linux Forums  

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 here.

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
How to read last line of a txt file? yongho UNIX for Dummies Questions & Answers 2 06-13-2005 10:20 AM
Read a file line by line VENC22 UNIX for Dummies Questions & Answers 2 05-12-2005 10:13 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 05:47 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-24-2008
Read Only
 

Join Date: Apr 2008
Posts: 40
read the file line by line

Hi All

Please help me , i have one big problem

I need to read this files line bye line
and print take it as arugument for another command
fileslist.txt
------------
112040108174516.txt
112040108174516.txt
112040108174516.txt
112040108174516.txt
112040108174516.txt
112040108174516.txt
112040108174516.txt



i want to print this list line by line my window.

Thanks in advance.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-24-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 2,999
Code:
#!/bin/ksh

while read line 
do
  myOtherCommand "${line}"
done < 'fileslist.txt'
Reply With Quote
  #3 (permalink)  
Old 04-24-2008
Registered User
 

Join Date: Aug 2007
Location: Bangalore
Posts: 285
do a try for this---

cat filename | while read line
do
echo $line
done

thanks
Reply With Quote
  #4 (permalink)  
Old 04-24-2008
Read Only
 

Join Date: Apr 2008
Posts: 40
problem with conditions if, for , while

Hi All,

when iam running the script with if or while
it showing following erros

Please any one clarify this

my script is:
------------
cat fileList.txt | while read line
do
echo $line
done

output:
--------
searchGateway.sh: line 14: syntax error near unexpected token `done'
searchGateway.sh: line 14: `done'


if i use if conditions
it shows error like
searchGateway.sh: line 14: syntax error near unexpected token `fi`
searchGateway.sh: line 14: `fi'

Please help me
Thankyou guys
Krish
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




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


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

Content Relevant URLs by vBSEO 3.2.0