I am having two file naming Extra_info and Class_info
Class_info contains data :
stuId stuName stuClass
S01 jagdeepJosh First
S02 harsh First
S03 Roop Second
S04 Kali Third
Extra_info contains extra information about student like
stuId stuCity stuEmail stuPhone
S01 SirsaPoh [email protected] 1234567890
I am getting result from both files using grep for stuId and displaying the result as:
res1=`grep $stuId $locDir/Class_info`
res2=`grep $stuId $locDir/Extra_info|cut -d" " -f2-`
## also I tried res2=`grep $stuId $locDir/Extra_info|awk '{$1="" ; print $0}'`
echo $res1 $res2
Instead of displaying:
S01 jagdeep First Sirsa [email protected] 1234567890
It is displaying:
Sirsa [email protected] 1234567890
As I could think at the time of echo the variable res2 is nullifying result from res1.
Please, suggest the possible reason for this and please provide solution for the same.