|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problems with one line output
my echo $var1 gives below value
Code:
i want it in 3 different values.... i.e. as Code:
the o/p of $1.7_NEW should be 25..... |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
You cannot assign variables named with numbers i.e.; Code:
a=somevalue 1.7_NEW=25 # this will generate an error. So, could you show us what your input data looks like, so we can help you get output? |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
hi jim
I did try the same.... but i did get error... so i taut of asking help from this forum... m getting this var1 value from DB with a simple select query.... |
|
#4
|
||||
|
||||
|
What are you about to perform with these variables ?
|
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Code:
echo "$var1" | awk -F[,=] '{print $2, $4, $6 } 'Start with that, and if you were to explain what you need rather than what you did, we could help more. |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Hi Nikhil, I am assuming this this varibale is coming from a script, where you are trying to fetch data from a database. In case you ment to see the variables in different lines rather online We can use 'tr' command, hope this helps. Code:
[Rob@mytestmachine~]# echo $var1|tr '[,]' '[\n]' 1.7_NEW=25 1.7_RETAINED=30 1.7_RETURNING=40 |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting line output to column based output | npatwardhan | Shell Programming and Scripting | 8 | 03-24-2010 09:40 AM |
| My output Problems | vinayrao | Shell Programming and Scripting | 1 | 02-12-2010 04:27 AM |
| problems getting a segment from a string output | tzvio | Shell Programming and Scripting | 5 | 10-23-2009 06:06 AM |
| Help please...output problems with printf. | pwanda | UNIX for Advanced & Expert Users | 3 | 10-19-2008 07:30 PM |
| how to make a line BLINKING in output and also how to increase font size in output | mail2sant | Shell Programming and Scripting | 3 | 04-14-2008 07:30 AM |
|
|