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 > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 03-19-2009
sunpraveen's Avatar
sunpraveen sunpraveen is offline
Registered User
  
 

Join Date: Jan 2009
Location: Pruthvi
Posts: 85
Quote:
Originally Posted by chengamsiva View Post
Replace
your line :user_prog_name=$(echo ${line} | awk '{print $3}')

by :user_prog_name=$(echo ${line} | awk '{print $3 $4 $5 $6}')
(or)
user_prog_name=$(echo ${line} | awk '{print $3 " " $4 " " $5 " " $6}') to provide single space " " between $3,$4,$5 and $6 when the values are store in variable.
Your solution works if the number of words in the column USER_PROG_NAME is know. But it is NOT.

It can contain 1, 2 or even 5 words with spaces seperating them.

So basically what I want is: from $3 to end of line.

How exactly can I achieve it?

TIA,

Regards,

Praveen