please rectify my problem

Dear Friends,

I have two data file containing 4 coloums.

my first file has data like this

ex:
file1:
2.56 66.82 ***
2.56 66.82 ***
2.54 66.84 ***
2.54 66.84 ***
2.51 66.84 ***
2.51 66.84 ***
2.51 66.86 ***
2.49 66.86 ***
2.47 66.86 ***
2.45 66.84 ***
2.44 66.86 ***

and second file having the data like this

   2.56    66.82   24.2
   2.56    66.82   23.6
   2.54    66.84   22.1
   2.54    66.84   28.1
   2.51    66.84   72.3
   2.51    66.84   \***
   2.51    66.86   \***
   2.49    66.86   \***
   2.47    66.86   \***
   2.45    66.84   \***
   2.44    66.86   \***

now my problem starts

now i want to add second file last coloum to my first file as a last coloum .

in both files first two coloums are same.

now how to add second file last coloum to first file as a last coloum

I think awk can solve my problem.

but i dont know how to write it.

please help me

thanks & regards
rajan

It is just a matter of cut and paste.

cut -d' ' -f3 file2.lst | paste file1.lst -

dear friend,

your code has not working

"not working" does not explain the error. What is the error that you are getting? Post the command that you are running, the output that you are getting and the output that you expect.

cut -d' ' -f3 2.txt |paste 1.txt -

2.56 66.82 *** 24.2
2.56 66.82 *** 23.6
2.54 66.84 *** 22.1
2.54 66.84 *** 28.1
2.51 66.84 *** 72.3
2.51 66.84 *** ***
2.51 66.86 *** ***
2.49 66.86 *** ***
2.47 66.86 *** ***
2.45 66.84 *** ***
2.44 66.86 *** ***

the above command gives the result u desired

Thank u vishnu_vaka your script is working fine.

please provide solution to this problem also.

after running the above script the output is like this.

2.56 66.82 *** 24.2
2.56 66.82 23.6 23.6
2.54 66.84 23.6 22.1
2.54 66.84 *** 28.1
2.51 66.84 *** 72.3
2.51 66.84 *** ***
2.51 66.86 *** ***
2.49 66.86 *** ***
2.47 66.86 *** ***
2.45 66.84 *** ***
2.44 66.86 *** ***

Now I want to delete lines where the third coloum has no data.
ie I want the data where the third coloum has not null.

like this
2.56 66.82 23.6 23.6
2.54 66.84 23.6 22.1

how to get this

please help

regards
rajan

vishnu_vaka's code is the same as what I had posted. I still cannot get how you got an error while running it. But to answer your last question,

cut -d' ' -f3 <name of second file> | paste <name of first file> -|awk '$3 !~ /\*\*\*/ {print}'

yes, blotorch is right
i send the same code as blotorch actually i didn't see it

the reply given by blotorch is working fine for the next problem u r given

bye

unless rajan didnt actually replace the filename in blowtorch's code by his own filenames :slight_smile: