![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Assign o/p of awk to a variable | c2b2 | Shell Programming and Scripting | 8 | 04-01-2009 07:50 AM |
| assign a value to a variable | Shivdatta | Shell Programming and Scripting | 10 | 01-17-2007 07:40 AM |
| assign value to variable using AWK | HAA | Shell Programming and Scripting | 4 | 12-06-2006 11:43 AM |
| assign a value to variable | markjason | Shell Programming and Scripting | 3 | 10-10-2006 02:05 PM |
| assign to variable | AkumaTay | UNIX for Dummies Questions & Answers | 1 | 05-18-2002 02:11 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Add another variable
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. I am post this script after check. It is running fine. concept: here we join the remaining last n coloumn and save it in a variable. byebye.. |
|
|||||
|
Quote:
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 |
|
||||
|
Hi,
Now Replace your line :user_prog_name=$(echo ${line} | awk '{print $3}') by :user_prog_name=$(echo ${line} | awk '{for (a = 3; a <= NF; a++) print $a }') |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| awk, whitespace |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|