Can anyone help me with an issue I have with gawk on AIX4.3.3?
The following worked with gawk on Tru64 unix but doesnt on AIX:-
[WAVESDEV:root]/usr/local/bin/waves> vi waves_create_staff
"waves_create_staff" 35 lines, 861 characters
gawk -F, -v username=$1 -v fullname="$2" -v password=$3 -v gname=$4 chopn=$5 '
$0 == "" { print $0 ; next }
{
split($1, a, "+"
if ( a[2] == gname )
printf "%s+%s", a[1], chopn
else
printf "%s+%s", a[1], username
if ( NF == 1 ) {
printf "\n"
next
}
if ( $2 == "DESCRIPTION" && a[2] != gname ) {
printf ",DESCRIPTION,%s\n", fullname
next
}
if ( $2 == "PASSWORD" && a[2] != gname ) {
printf ",PASSWORD,%s\n", password
next
}
if ( $2 == "MYGROUP" && a[2] != gname ) {
printf ",MYGROUP,%s\n", chopn
next
}
for( i=2; i <= NF; i++ ) {
printf ",%s", $i
}
printf "\n"
}'
commmand is
cat file | above procedure passing variables.
get following error::-
gawk: cmd. line:2: fatal: cannot open file `
$0 == "" { print $0 ; next }
{
split($1, a, "+"
if ( a[2] == gname )
printf "%s+%s", a[1], chopn
else
printf "%s+%s", a[1], username
if ( NF == 1 ) {
printf "\n"
next
}
if ( $2 == "DESCRIPTION" && a[2] != gname ) {
printf ",DESCRIPTION,%s\n", fullname
next
}
if ( $2 == "PASSWORD" && a[2] != gname ) {
printf ",PASSWORD,%s\n", password
next
}
if ( $2 == "MYGROUP" && a[2] != gname ) {
printf ",MYGROUP,%s\n", chopn
next
}
for( i=2; i <= NF; i++ ) {
printf ",%s", $i
}
printf "\n"
}' for reading (File name too long)
The following worked with gawk on Tru64 unix but doesnt on AIX:-
[WAVESDEV:root]/usr/local/bin/waves> vi waves_create_staff
"waves_create_staff" 35 lines, 861 characters
gawk -F, -v username=$1 -v fullname="$2" -v password=$3 -v gname=$4 chopn=$5 '
$0 == "" { print $0 ; next }
{
split($1, a, "+"
if ( a[2] == gname )
printf "%s+%s", a[1], chopn
else
printf "%s+%s", a[1], username
if ( NF == 1 ) {
printf "\n"
next
}
if ( $2 == "DESCRIPTION" && a[2] != gname ) {
printf ",DESCRIPTION,%s\n", fullname
next
}
if ( $2 == "PASSWORD" && a[2] != gname ) {
printf ",PASSWORD,%s\n", password
next
}
if ( $2 == "MYGROUP" && a[2] != gname ) {
printf ",MYGROUP,%s\n", chopn
next
}
for( i=2; i <= NF; i++ ) {
printf ",%s", $i
}
printf "\n"
}'
commmand is
cat file | above procedure passing variables.
get following error::-
gawk: cmd. line:2: fatal: cannot open file `
$0 == "" { print $0 ; next }
{
split($1, a, "+"
if ( a[2] == gname )
printf "%s+%s", a[1], chopn
else
printf "%s+%s", a[1], username
if ( NF == 1 ) {
printf "\n"
next
}
if ( $2 == "DESCRIPTION" && a[2] != gname ) {
printf ",DESCRIPTION,%s\n", fullname
next
}
if ( $2 == "PASSWORD" && a[2] != gname ) {
printf ",PASSWORD,%s\n", password
next
}
if ( $2 == "MYGROUP" && a[2] != gname ) {
printf ",MYGROUP,%s\n", chopn
next
}
for( i=2; i <= NF; i++ ) {
printf ",%s", $i
}
printf "\n"
}' for reading (File name too long)