![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with output of find command being input to basename command... | new_learner | UNIX for Dummies Questions & Answers | 2 | 12-14-2008 02:56 AM |
| awk/sed Command : Parse parameter file / send the lines to the ksh export command | rajan_san | Shell Programming and Scripting | 4 | 11-06-2008 01:29 PM |
| assign a command line argument and a unix command to awk variables | sweta_doshi | Shell Programming and Scripting | 0 | 08-08-2008 06:54 AM |
| Help Required: Command to find IP address and command executed of a user | loggedout | Security | 2 | 08-06-2008 08:12 PM |
| inconsistent ls command display at the command prompt & running as a cron job | rajranibl | SuSE | 5 | 07-30-2007 08:26 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I don't know why you want first and last in the same string but here's an answer (there are many possible methods).
There are significant benefits to keeping the first and last separate (ie, if the person is a Jr, Sr. III etc) or has a hyphenated name or multiple sirnames... #!/usr/bin/sh echo "Enter your full name (i.e. first and last name)" read name echo "Hello Mr. `echo $name | awk '{print $NF}'`" Good luck.... |
|
||||
|
Quote:
Cat aw1.sh echo "Please enter your full name:" read name echo $name | awk '{print"Hello Mr.", $2}' pa9442 /ms/user/s/sibasha/tmp1 70$ sh aw1.sh Please enter your full name: Siba Nayak Hello Mr. Nayak |
|
||||
|
Absolutely it's one of the best text processor AWK or GAWK whatever.
This is the correct sentences for your problem: name="Mike Pathon" echo $name | awk '{print "Hello Mr.", $2}' |
| Sponsored Links | ||
|
|