I have the file as below
server1 no dr aix 5300-05-03 9119-595 20-18888 yes ftp-eagle
server2 no dr aix 5300-05-03 9119-595 20-18888 yes ftp-eagle
server3 yes dr aix 5300-05-03 9119-595 20-18888 yes ftp-eagle
server4 yes dr aix 5300-05-03 9119-595 20-18888 yes ftp-eagle
When I run below from the shell :-
#FileName=/list.config
#cat $FileName | grep -v "#" | sed -e 's/ / /g' | awk '{print $1,$2}'| grep -w yes| cut -d' ' -f1
server3
server4
Now when I run from the shell script in this way:-
#!/bin/ksh
FileName=/list.config
awkfilter="$1,$2"
filter_string="yes"
temp_str=(cat $FileName | grep -v "#" | sed -e 's/ / /g' | awk '{print '$awk_filter'}' | grep -w "$temp_str1$Filter_String" |cut -d' ' -f1)
echo $temp_str
#######
is not giving the same above output that gave me from the shell.
The set -x for the cat in the script is :-
+ + cat /list.config
+ grep -v #
+ sed -e s/ / /g
+ awk {print $1,$2}
+ cut -d -f1
+ grep -w yes
temp_str=
+ echo
Can somebody please help me out to find why its not working inside the script?