I have another Question:
I tried to run the following script: (I actually wanted to print out the second field in the text field.)
#!/usr/bin/ksh
set -x
readfile=/dir1/data.txt
cat $readfile | while read line
do
x = `echo $line|awk '{print $2}'`
echo $x
done
But, it shows the following error. It is unable to read the 'x' value.
# ./readData
+ readfile=/dir1/data.txt
+ cat /dir1/data.txt
+ read line
+ awk {print $2}
+ echo skhfkjshf 24343
+ x = 24343
./readData[7]: x: not found
+ echo
+ read line
+ awk {print $2}
+ echo jsdhfklhd 94890
+ x = 94890
./readData[7]: x: not found
+ echo
I have given all the permissions.. chmod 777 readData
Please help me out in solving this issue.
Thanks in advance.