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
read some lines from file!!! andy2000 Shell Programming and Scripting 7 03-28-2007 04:55 AM
Read lines from file sagolo UNIX for Dummies Questions & Answers 2 11-27-2006 03:14 AM
How to read lines from a flat file bihani4u Shell Programming and Scripting 2 09-28-2006 01:54 PM
Read the lines from the file in batch amitraorane Shell Programming and Scripting 2 01-26-2006 01:51 PM
How to read specific lines in a bulk file using C file Programming rajan_ka1 High Level Programming 10 11-10-2005 03:29 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 09-28-2006
bihani4u bihani4u is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 11
how to read lines one by one from a file

I have one file in which some commands have written line line
i have to read lines from this file(file name passed as avariable)
and then i have to execute these commands..
how can i do it?
  #2 (permalink)  
Old 09-28-2006
mdhmi mdhmi is offline
Registered User
  
 

Join Date: Sep 2006
Location: Detroit, Michigan
Posts: 23
You can do your own homework for starters.

Post the code you've written so far and then ask for help.
  #3 (permalink)  
Old 09-28-2006
bihani4u bihani4u is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 11
i have written this script for create mqsc command which are stored in {Outfile}.now i have to run these commands.
iam passing two file in this function.

function CreateAlterFile {
#Eliminate Comments and blanklines
grep -vE "^[ ]*#|^ *$" ${1} |
while read CHAN TYPE
do
echo "STOP "${CHAN} >>${OUTFILE};
echo "ALTER "${CHAN}" "${TYPE} "CONNAME("${2}")" >> ${OUTFILE};
done;
}

Now after this i have to run commands stored in {outfile}
how can i do it
  #4 (permalink)  
Old 09-28-2006
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,937
eval "$line"

will execute the line.
  #5 (permalink)  
Old 09-28-2006
bihani4u bihani4u is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 11
pls help me out

i tried that..but ihave to execute each line..
by using a loop
what iwas trying is
grep -vE "^[ ]*#|^ *$" ${1} | (${1} is the file name)
while read something (that idont know what to do to get full line)
do
echo "something" |runmqsc qmgr;
done;

pls help me out what shd i use for read full line from file
  #6 (permalink)  
Old 09-28-2006
bihani4u bihani4u is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 11
Finally I got the answer myself
it is like this

while read line
do
(command) ${line}
done < filename
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 05:38 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