how to concatinate two strings


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to concatinate two strings
# 1  
Old 10-19-2006
how to concatinate two strings

hi all
plz let me know how to concatinate two strings.
requirement is "I need send a mail with some data available in data.txt and data in variable"

ex: abc.txt contains "abcdefghjikmnb"
x="QWERTY"
now i need concatinate data in file and data in variable x and send a mail.

thanks & regards
-Bali Reddy
# 2  
Old 10-19-2006
Hi,

As far as i understand, u don't need concatenation. What u need is put that variable into the file and send mail... Then the following will help:
Taking ur example:
File - abc.txt
Variable - x

Code:

echo $x >> abc.txt
mail balireddy_77 < abc.txt

Note: In the above,i presume ur unix account username is balireddy_77
justsam
# 3  
Old 10-19-2006
if you need them side by side and has a single line in file, try:

echo "${X}`cat abc.txt`" | mail someone@host

if your file has more than one line and you want to send an email for each one, try:

while read MYLINE
do
echo "${X}${MYLINE}" | mail someone@host
done < abc.txt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Use strings from nth field from one file to match strings in entire line in another file, awk

I cannot seem to get what should be a simple awk one-liner to work correctly and cannot figure out why. I would like to use patterns from a specific field in one file as regex to search for matching strings in the entire line ($0) of another file. I would like to output the lines of File2 which... (1 Reply)
Discussion started by: jvoot
1 Replies

2. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies

3. UNIX for Dummies Questions & Answers

Issue when using egrep to extract strings (too many strings)

Dear all, I have a data like below (n of rows=400,000) and I want to extract the rows with certain strings. I use code below. It works if there is not too many strings for example n of strings <5000. while I have 90,000 strings to extract. If I use the egrep code below, I will get error: ... (3 Replies)
Discussion started by: forevertl
3 Replies

4. Programming

concatinate all lines from second line to end of line in perl

I have datafile like ~dta.yunm shhshsgggssssjsksjs sggsjshsjsjssss shshshhshshshs i wish to take only first line and all other lines in concatenated form in second line what should I do??? output like ~dta.yunm shhshsgggssssjsksjssggsjshsjsjssssshshshhshshshs please tell me how... (7 Replies)
Discussion started by: sujit_singh
7 Replies

5. Shell Programming and Scripting

Delete lines in file containing duplicate strings, keeping longer strings

The question is not as simple as the title... I have a file, it looks like this <string name="string1">RZ-LED</string> <string name="string2">2.0</string> <string name="string2">Version 2.0</string> <string name="string3">BP</string> I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies

6. UNIX for Dummies Questions & Answers

Delete strings in file1 based on the list of strings in file2

Hello guys, should be a very easy questn for you: I need to delete strings in file1 based on the list of strings in file2. like file2: word1_word2_ word3_word5_ word3_word4_ word6_word7_ file1: word1_word2_otherwords..,word3_word5_others... (7 Replies)
Discussion started by: roussine
7 Replies

7. Shell Programming and Scripting

concatinate a string with output of echo statement

I need to concatinate a string (mapping-expression) with the output of below statement EXPRESS="cat //normalization-binding//tag-normalization/tag-name" echo $EXPRESS | xmllint --shell QA_Oct12_DIR.cfb | grep -v "/ >" >> "/home/testBinding.txt" above statement write value="$6061" into... (1 Reply)
Discussion started by: bkc
1 Replies

8. Shell Programming and Scripting

Please concatinate these 2 strings , bcoz i cant

Hi All, Can any one concatinate these two strings I have string suppliername=UGEN i need ouput like filename=UGEN.txt i need to add ".txt" to UGEN please help me (2 Replies)
Discussion started by: kittusri9
2 Replies

9. Shell Programming and Scripting

how to concatinate two strings

Hi All, I have to run one command in my script. str1="SLAND" str2="MIMUS" gateway=`ssh root@mrp-gateway 'cd /usr/local/apache/data/SLAND && ls 108021808*.txt` gateway=`ssh root@mrp-gateway 'cd /usr/local/apache/data/MIMUS && ls 108021808*.txt` I need to place this str1 and str2... (1 Reply)
Discussion started by: kittusri9
1 Replies

10. Shell Programming and Scripting

How to concatenate two strings or several strings into one string in B-shell?

like connect "summer" and "winter" to "summerwinter"? Can anybody help me? thanks a lot. (2 Replies)
Discussion started by: fontana
2 Replies
Login or Register to Ask a Question