concatenate varaibles var1, var2 together to var1 again


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting concatenate varaibles var1, var2 together to var1 again
# 1  
Old 10-26-2009
concatenate varaibles var1, var2 together to var1 again

HI

i like to concatenate the two variables
var1=$line (ie 22885068900000652 B86860003OLFXXX592123320081227)
var2=$amount (ie 123456)

i want to club together both the above varaible var1 & var2 and assign back to var1

right now i am doing like this but it is not working.
var1=`echo $var1" "$var2`

result should be
$var1
22885068900000652 B86860003OLFXXX592123320081227 123456

Thanks
# 2  
Old 10-26-2009
Code:
var1="22885068900000652 B86860003OLFXXX592123320081227"
var2="123456"
var1="$var1 $var2"
echo $var1

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to setup command and varaibles one time in a server?

Hi All, Am working on several solaris server and login as root. As soon as access the server as root user, i need to type in below command/set : bash;set -o vi Is there any root profile file i can set this, so that i don't need to keep typing this command as when i access the... (1 Reply)
Discussion started by: Optimus81
1 Replies

2. Shell Programming and Scripting

Convert .../($var1|$var2)/... regex to string

Hello, In one part of my shell program I need to translate many of lines in the following pattern : /(folder1|...|folderN)/(sub1|...|subN)/.../(file1|...|fileN) into strings : /folder1/sub1/.../file1 /folder1/sub1/.../... /folder1/sub1/.../fileN ... /folderN/subN/.../fileN the... (2 Replies)
Discussion started by: Ghadamyari
2 Replies

3. UNIX for Dummies Questions & Answers

concatenate strings

if i use echo "ravi" echo "sankar" it showing output ravi sankar but i want output as ravi sankar remember sankar should be in another echo statement only (2 Replies)
Discussion started by: shankr3
2 Replies

4. Shell Programming and Scripting

Concatenate files

I have directory structure sales_only under which i have multiple directories for each dealer example: ../../../Sales_Only/xxx_Dealer ../../../Sales_Only/yyy_Dealer ../../../Sales_Only/zzz_Dealer Every day i have one file produce under each directory when the process runs. The requirement... (3 Replies)
Discussion started by: mohanmuthu
3 Replies

5. UNIX for Dummies Questions & Answers

Concatenate Strings

Hi Friends, I have a requirement I need to concatenate the below two strings. String 1 = /@jobid_at_ String 2 = value stored in ORACLE_SID String 3 = string1 concatenated with String 2. Please let me know how should i do it in UNIX. Thanks, (2 Replies)
Discussion started by: diva_thilak
2 Replies

6. UNIX for Dummies Questions & Answers

What is this? var2=${var1#??????????}

Googling the answer to this question just doesn't work when Google won't search your symbols for you. Can someone tell me what this command will assign to var2, and where I can find more information about using braces in this way? var2=${var1#??????????} Thanks so much. (2 Replies)
Discussion started by: blondie53403
2 Replies

7. Shell Programming and Scripting

(probably stupidly simple) if [ $var1 = $var2 ] problem...

OK, while I'm not new to the Mac or some of the the inner workings of Mac OS X I am quite new to scripting. And while I have "Learning the Bash Shell" by those lovely people at O'Reilly (Cameron Newham et. al.) I'm missing something, I just know I am. Here's the problem: At the beginning of... (2 Replies)
Discussion started by: woodgie
2 Replies

8. Shell Programming and Scripting

Echo var1,var2,var3,var4,var5,var6 in loop help

Hello, I have created numerous variables called $mask1 $mask2... $maskN. I wish to echo these variables, below is the code for the two functions, the first creates the variables and the second echos them. It is the second function which does not work. The line (i believe to be wrong) is in... (1 Reply)
Discussion started by: rorey_breaker
1 Replies

9. Linux

retaining the evironment varaibles...

Hi all, I wrote a shell script in which one of the if condition i tried to set few variables and exported them...and when i am out of if condition i wish to run one of my script which uses those variables exported. But i found that when i am out of the if statement those variables... (5 Replies)
Discussion started by: priya444
5 Replies

10. UNIX for Dummies Questions & Answers

*fixed if (( var1 && var2 )) ??

*EDIT -- **FIXEd I must've done something wrong, because it works now.. I punched in "if" in the forum search but nothing came up, so I'm posting it here. Quick question: Can someone correct my syntax. #!/bin/ksh if (( var >= 1 && var <= 5 )); then .................................. (1 Reply)
Discussion started by: yongho
1 Replies
Login or Register to Ask a Question