if i have 2 files file1 and file2....
file1 contains 2 columns like
b a
11 aa
12 as
13 ad
15 ag
11 ar
13 ah
15 ak

file2 contains
b c
10 ds
11 at
15 gh
15 jk
13 iu
11 fg
13 yy

can any 1 give me the program to display in this way?
a b c
aa 11 at
ar 11 fg
ad 13 iu
ah 13 yy
ag 15 gh
ak 15 jk

Answers were Sorted based on User's Feedback



if i have 2 files file1 and file2.... file1 contains 2 columns like b a 11 aa 12 as..

Answer / sudhir

paste file1 file2 | cut -f 2,3,4 -d " "

Is This Answer Correct ?    1 Yes 0 No

if i have 2 files file1 and file2.... file1 contains 2 columns like b a 11 aa 12 as..

Answer / pitambar mishra

Sorry Sudhir,
Your syntax is wrong.It should be
paste file1 file2|cut -d " " -f2,3,4
But this command is n't providing the correct result.
Piz try another.

Is This Answer Correct ?    0 Yes 0 No

if i have 2 files file1 and file2.... file1 contains 2 columns like b a 11 aa 12 as..

Answer / kirtiranjan sahoo

paste file1 file2 | cut -d" " -f2,3,4 | sort -n -k2

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Shell Script Interview Questions

I want to read all input to the command from file1 direct all output to file2 and error to file 3, how can I achieve this?

1 Answers  


Is shell scripting useful?

0 Answers  


Can shell script run on windows?

0 Answers  


if i have 2 files file1 and file2.... file1 contains 2 columns like b a 11 aa 12 as 13 ad 15 ag 11 ar 13 ah 15 ak file2 contains b c 10 ds 11 at 15 gh 15 jk 13 iu 11 fg 13 yy can any 1 give me the program to display in this way? a b c aa 11 at ar 11 fg ad 13 iu ah 13 yy ag 15 gh ak 15 jk

3 Answers  


Why is it called a shell?

0 Answers  






How to print some text on to the screen?

2 Answers  


‎What is a shell? · ‎Types of shell · ‎what is shell scripting?

0 Answers  


write a shell script to check whether all the directories in the path exist has read and write permission

1 Answers  


How important is shell scripting?

0 Answers  


How do scripts work?

0 Answers  


how did u debugging in unix/ linux platform ??( project Related)

2 Answers   Symphony,


What is $1 in shell scripting?

0 Answers  


Categories