The information of the two files should be redirect to
Third file in such a way that, the third file contain the
information like this.

1st line in third file should be from 1st file
2nd line in Third file should be from 2nd file
3rd line in Third file should be from 1st file
4th line in Third file should be from 2nd file
-
- so on

Answer Posted / amol

Unix utility sed can be used serve the purpose
Assuming file1.txt and file2.txt are two input files and
file3.txt is the third file.

Contents of the file1.txt
line 1
line 2
line 3

Contents of the file2.txt
LINE 1
LINE 2
LINE 3


After executing below mentioned command

sed -n -e '{
> R file2.txt
> p
> }' file1.txt > file3.txt


The third file file3.txt will be
line 1
LINE 1
line 2
LINE 2
line 3
LINE 3

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What language is shell scripting?

579


How do we create command aliases in a shell?

538


What does $@ mean in shell?

590


Write down the syntax of "for " loop

607


What can scripts do?

662






What is mac default shell?

614


What lives in a shell?

537


What will happen to my current process when I execute a command using exec?

536


What is shell application?

567


What is scripting autism?

700


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); }

1851


How to print all array elements and their respective indexes?

501


What makes c shell a more preferable option than the bourne shell?

534


What happens when you type ls?

558


Suppose you execute a command using exec, what will be the status of your current process in the shell?

576