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

Write a script to print the first 10 elements of fibonacci series.

0 Answers  


What is web script?

0 Answers  


What is meant by dos operating system?

0 Answers  


What is inside a seashell?

0 Answers  


How to get the last line from a file using just the terminal?

0 Answers  






Please give me example of " at command , contrab command " how to use

0 Answers  


What is the basic difference you find between a shell script and perl?

3 Answers   Yahoo,


There is a record with fields namely name,roll no.,salary,grade etc.Now,write a script to create a file with multiple records have same combination of fields but with unique roll numbers.The script should work for different names in the input file.

1 Answers   Wipro,


Explain about "s" permission bit in a file?

0 Answers  


How to replace following lines, catch (DAOException e) { objLogger.error(this.getClass () + "addUpdateIssues() " + e); throw new BOException(5122); } catch (BOException e) { objLogger.error(this.getClass () + "addUpdateIssues() " + e); throw e; } catch (Exception e) { objLogger.error(this.getClass () + "addUpdateIssues() " + e); throw new BOException(5122); } Needs to be changed in to, catch (DAOException e) { AppException.handleException (null, null, e, null, null, null, "BOException", this.getClass() + "addUpdateIssues() ", null, null, null, null, null, null, null, null, 5122); } catch (BOException e) { AppException.handleException (null, null, null, e, null, null, "BOException", this.getClass() + "addUpdateIssues() ", null, null, null, null, null, null, null, null, 0); } catch (Exception e) { AppException.handleException (null, null, null, null, null, e, "BOException", this.getClass() + "addUpdateIssues() ", null, null, null, null, null, null, null, null, 5122); }

0 Answers   Wipro,


Create a bash shell script that reads in a number from the user. If the number is 1, print out the date. If the number is 2, list the files in the current directory. If the number is 3, print out who is currently logged onto the system. If the number is anything else, print out an error message and exit. Name this script "various.sh"

4 Answers  


What is the default shell of solaris?

0 Answers  


Categories