Awk in a for loop [message #279340] |
Wed, 07 November 2007 18:58 |
mohapatra
Messages: 24 Registered: August 2006 Location: New Jersey
|
Junior Member |
|
|
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??
|
|
|
|
|