![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Korn shell and awk question | mastachef | Shell Programming and Scripting | 6 | 10-31-2007 07:15 AM |
| korn shell question | mich_elle | Shell Programming and Scripting | 4 | 02-22-2006 09:03 PM |
| Korn Shell Coprocess Performance Question | Mark Puddephat | Shell Programming and Scripting | 8 | 12-14-2005 05:33 PM |
| AWK question in the KORN shell | penfold | Shell Programming and Scripting | 11 | 02-09-2005 09:14 AM |
| Question about Korn Shell | Latha Nair | Shell Programming and Scripting | 13 | 11-05-2003 07:30 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I'm needing help with assigning variables inside a while loop of ksh script.
I have an input text file and ksh script below and I'm trying to create a script which will read the input file line by line, assign first and second word to variables and process the variables according to the contents. Code:
$ more file.txt
AAA 001
BBB 002
CCC 003
DDD 004
$ more looptest.ksh
#! /bin/ksh
while read line
do
awk '{print FS,$1}' >> var1
awk '{print FS,$2}' >> var2
if [[ $var1 = AAA ]]
then
echo group1 $var2
elif [[ $var1 = CCC ]]
then
echo group2 $var2
fi
done < file.txt
group1 001 group2 003 |
|
|||||
|
This page has several links to good sites.
http://stommel.tamu.edu/~baum/programming.html |
|
|||||
|
Additionally, you could check this link for Korn shells specifically.
http://www.unix.org.ua/orelly/unix/ksh/ |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|