Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Search Forums:



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-08-2012
Registered User
 

Join Date: Dec 2011
Posts: 31
Thanks: 22
Thanked 1 Time in 1 Post
Smile ADD Column Btw two column

I want to add column btw to column

Input

Code:
ABCDE2012 120 21.6
ABCDE2012 126 0.9
PLKJHN2012 128 20.2
UNHYT2012 1210 -0.3


Output//

Code:
Column 1      Column 2          Cl 3     Cl4
ABCDE2012	 ABCDE2012120	120	21.6
ABCDE2012	 ABCDE2012126	126	0.9
PLKJHN2012	 PLKJHN2012128	128	20.2
UNHYT2012	 UNHYT20121210	1210	-0.3



I want join two column btw two column//

Last edited by Franklin52; 02-10-2012 at 02:41 AM.. Reason: Please use code tags for code and data samples, thank you
Sponsored Links
    #2  
Old 02-09-2012
ahamed101's Avatar
root is god!!!
 

Join Date: Sep 2008
Location: India
Posts: 1,478
Thanks: 33
Thanked 382 Times in 377 Posts

Code:
 awk '{print $1, $1$2, $3, $4}' infile

--ahamed
The Following User Says Thank You to ahamed101 For This Useful Post:
pareshkp (02-09-2012)
Sponsored Links
    #3  
Old 02-09-2012
balajesuri's Avatar
#! /bin/bash
 

Join Date: Apr 2009
Location: India
Posts: 1,019
Thanks: 9
Thanked 285 Times in 277 Posts

Code:
while read a b c; do echo "$a $a$b $c"; done < inputfile

The Following User Says Thank You to balajesuri For This Useful Post:
pareshkp (02-09-2012)
    #4  
Old 02-09-2012
Registered User
 

Join Date: Dec 2011
Posts: 31
Thanks: 22
Thanked 1 Time in 1 Post
Thanks a lot guys ......

But how can i save my out put in variable or file ....


here is my code.....

I found Solution .....


Thanks lot for your help guys////////

Last edited by pareshkp; 02-09-2012 at 11:59 AM..
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Rename a header column by adding another column entry to the header column name Vavad UNIX for Dummies Questions & Answers 1 08-06-2011 01:02 PM
Rename a header column by adding another column entry to the header column name URGENT!! Vavad Shell Programming and Scripting 4 08-05-2011 12:35 PM
Need to add letters to a column and add in a new column subtracting from another column kellywilliams Shell Programming and Scripting 3 01-27-2011 09:50 PM
Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2 rydz00 Shell Programming and Scripting 7 11-09-2010 10:28 AM
Changing one column of delimited file column to fixed width column manneni prakash Shell Programming and Scripting 5 06-22-2009 05:27 AM



All times are GMT -4. The time now is 04:49 AM.