Hello,
This is my first post and I've just started on UNIX in school.
A file name "list" has the following content (excluding the numbers and the bottom part):
1 2 3 4 5 6
0123456789012345678901234567890123456789012345678901234567890
IT Karen Patel Wimps Ranjit Singh FULL
EngineeringKaren Thompson Vegans John Thompson PART
Marketing Ken Whillans Eagles Karen Thompson FULL
Names: 11-26
Team Name: 27-39
Partner: 40-53
What I want to do is to output the player's name with the partner's name right next to it. This is what I've done so far:
echo "Player name?"
read player
name=`grep $player........................... list | cut -c12-26 | sed 's;^ *;;;s; *, *;,;g;s; *$;;'`
target=`grep $player........................... list | cut -c40-54 | sed 's;^ *;;;s; *, *;,;g;s; *$;;'`
if [ $(echo $name | wc -w) -eq 0 ]
then
echo "No such player."
else
echo -e "$name's target is $target.\n"
fi
When the user puts "K" as the player's name, I want the output in this format:
Karen Patel's partner is Ranjit Singh.
Karen Thompson's partner is John Thompson.
Ken Whillans 's partner is Karen Thompson.
but the output that I get is:
Ken Whillans
Karen Thompson
Karen Patel's team name is Eagles
Vegans
Wimps.
How can I fix this problem?
Thank You.