The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




Thread: Awk Command
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #15 (permalink)  
Old 12-30-2008
kazazza kazazza is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 9
When i use the code:

echo "Please enter your full name:"
read name
echo $name | awk '{print"Hello Mr." $2}'

And enter a first middle and surname e.g. john bloggs smith then it outputs 'Hello Mr. bloggs' instead of 'Hello Mr. smith'.

And if i use the code:

echo $name | awk '{print"Hello Mr." $0}'

And enter a first middle and surname e.g. john bloggs smith then it outputs 'Hello Mr. john bloggs smiths' instead of 'Hello Mr. smith'.

AHHH lol. Thanks very much for all your help

Last edited by kazazza; 12-30-2008 at 05:39 PM..