networkguy
Technical User
I'm trying to replace a specific field (field #12) in a string of fields separated by ;. The value for the field is the user input so basically it's a variable. The following is my script that doesn't seem to be working (OS=AIX 4.3.3):
#! /bin/ksh
read username?"Please enter your username:"
read password?"Please enter your password:"
awk 'BEGIN {FS=";";OFS=";"} { $12=$password;print }' input > output
If I were to replace $password with "text" it works just fine but as soon as it encounters a variable it fails. Is awk the way to go in this case? Would greatly appreciate any help!!!
Eric
#! /bin/ksh
read username?"Please enter your username:"
read password?"Please enter your password:"
awk 'BEGIN {FS=";";OFS=";"} { $12=$password;print }' input > output
If I were to replace $password with "text" it works just fine but as soon as it encounters a variable it fails. Is awk the way to go in this case? Would greatly appreciate any help!!!
Eric