cancel
Showing results for 
Search instead for 
Did you mean: 

Join two Files

 
Highlighted
Advisor

Join two Files

Hi

I have 2 file

cat f1
1
2
3

cat f2
sun
mon
tue
wen

i want the out put as third file f3 with no tab in between "1" "sun"
#cat f3
1 sun
2 mon
3 tue

I used paste command as given below
#/usr/bin/paste -d\\ f1 f2 > /home/f3

Iam getting the req output,

#/usr/bin/paste -d\\ /home/f1 /home/f2 > /home/f3

but wen i used above command(the path of the file included), iam getting error.


Will anyone help me to solve this problem by using the path or any other command for joining two file without tab
4 REPLIES 4
Highlighted
Honored Contributor

Re: Join two Files

With a space instead of TAB:
paste -d " " f1 f2

With no character at all:
paste -d "" f1 f2

MK
MK
Highlighted
Advisor

Re: Join two Files

Dear Friend is that possible With out space,
is any command for that?
Highlighted
Respected Contributor

Re: Join two Files

you're escaping the escape character "\"

try use only one "\" following by a space.
#/usr/bin/paste -d\ /home/f1 /home/f2 > /home/f3


I personally would use -d " " instead.
Highlighted
Honored Contributor

Re: Join two Files

Tinu,

>..is that possible With out space,
is any command for that:

- Yes , check this out: this is without inserting a space



# paste f1 f2 | awk '{print $1,$2}' > f3


Enjoy, Have fun!,
Raj.

" If u think u can , If u think u cannot , - You are always Right . "