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
Executing scripts in Parallel itsme_maverick Shell Programming and Scripting 2 06-06-2008 11:23 AM
Reading 5 Students names and grades using while loop???? dlbomber1 Shell Programming and Scripting 1 11-26-2007 02:46 AM
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
Executing Shell Scripts BuyoCat UNIX for Dummies Questions & Answers 1 09-07-2005 01:11 AM
executing variables in ksh scripts? zedmelon Shell Programming and Scripting 3 08-06-2003 01:50 PM

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

Join Date: Oct 2007
Posts: 14
Unhappy executing scripts by reading names from a file

file.txt contains
------------------
sat1 1300
sat2 2400
sat3
sat4 500

I need to write a shell script that will output like the below
#output

sat1.ksh 1300
sat2.ksh 2400
sat3.ksh
sat4.ksh 500

my try
-------
#!/bin/ksh

for i in `cat file.txt`
do
SCR_NAME=`echo $i| awk '{print $1}'`
PARAM=`echo $i| awk '{print $2}'`
echo "${SCR_NAME}.ksh ${PARAM}"
# want to call a function here in future
done

can someone please advise??

~

Last edited by konark; 11-07-2007 at 08:23 PM..
  #2 (permalink)  
Old 11-07-2007
konark konark is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 14
Any suggestion for the above query '??

Last edited by konark; 11-07-2007 at 08:25 PM..
  #3 (permalink)  
Old 11-07-2007
konark konark is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 14
Unhappy

FILE=file.txt

for i in `cat $FILE`
do
SCR_NAME=`awk '{print $1}' $i`
PARAM=`awk '{print $2}' $i`
echo "${SCR_NAME}.ksh ${PARAM}"
done


I m trying to do something like this. It doesnt work .Can you please help
~
~
~
  #4 (permalink)  
Old 11-08-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,513
Code:
awk '{$1=$1".ksh"}1' file
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 06:07 AM.


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