![]() |
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 |
| need to concatenate two lines if the line doesnt end with quotes | laxmi131 | UNIX for Advanced & Expert Users | 9 | 10-27-2008 07:22 AM |
| concatenate all duplicate line in a file. | vaskarbasak | Shell Programming and Scripting | 30 | 08-29-2008 05:31 AM |
| concatenate and display 2 lines as 1 with a condition for 2 line ? | vithala | Shell Programming and Scripting | 7 | 07-11-2008 01:01 AM |
| How to append some strings line by line? | xinoo | Shell Programming and Scripting | 4 | 06-24-2008 02:04 AM |
| how to concatenate two command in one line and get the display in one screen | vasikaran | UNIX for Dummies Questions & Answers | 9 | 07-01-2005 05:41 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi, I have a noob question . Can someone help me how to concatenate line by line using this variables?
var1: Apple| Banana| var2: Red Yellow then how can I concatenate both line by line? in which the result would be: Apple|Red Banana|Yellow just to generate a row result i was using: var1=$( cat <<-__EOF__ APPLE BANANA __EOF__ ) var2=$( cat <<-__EOF__ RED YELLOW __EOF__ ) I tried using unix paste but I do not know how to use it if it is a variable. Thanks for your help. |
|
||||
|
I cant because if another user is using the page. it may cause conflict.
This is the solution I used by the way in case someone might need it also. allData=$(echo "$var1" | awk -v var2="$var2" ' {split(var2,arr1,"\n");print $0""arr1[NR]} ') allData holds now the concatenated data line by line. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|