Output of two files One After Another


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Output of two files One After Another
# 1  
Old 09-28-2009
Java Output of two files One After Another

Hi Can we put output of two files one after another?
For example i have two files.

File1.txt ---
Code:
CDTBIPX      UNIX      6624
CDTBIPX      UNIX      6625
CDTBIPX      UNIX      6626
CDTBIPX      UNIX      6627

File2.txt
Code:
20090928 11:30:01 6624 0
20090928 12:00:01 6625 0
20090928 12:30:00 6626 0
20090928 13:00:01 6627 0

Now i want then to arrange in one line like
Code:
CDTBIPX      UNIX      6624    20090928 11:30:01 6624 0
CDTBIPX      UNIX      6625    20090928 12:00:01 6625 0
CDTBIPX      UNIX      6626    20090928 12:30:00 6626 0
....

AND

Code:
UNIX      6624   11:30:01    CDTBIPX      
UNIX      6625   12:00:01    CDTBIPX      
UNIX      6626   12:30:00    CDTBIPX

Can you please help

Last edited by vgersh99; 09-28-2009 at 10:08 AM.. Reason: code tags, PLEASE!
# 2  
Old 09-28-2009
look into 'man paste'

---------- Post updated at 09:08 AM ---------- Previous update was at 09:07 AM ----------

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums
# 3  
Old 09-28-2009
please find the commands

1st output - paste File1.txt File2.txt
2nd outupt - paste File1.txt File2.txt|awk '{print $2,$3,$5,$1}'
# 4  
Old 09-30-2009
thanks

Quote:
Originally Posted by uthay85
please find the commands

1st output - paste File1.txt File2.txt
2nd outupt - paste File1.txt File2.txt|awk '{print $2,$3,$5,$1}'


thnaks dear, this was really helpful.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SBATCH trinity for multiple files and rename/move the output files

Hey guys, I have wrote the following script to apply a module named "trinity" on my files. (it takes two input files and spit a trinity.fasta as output) #!/bin/bash -l #SBATCH -p node #SBATCH -A <projectID> #SBATCH -n 16 #SBATCH -t 7-00:00:00 #SBATCH --mem=128GB #SBATCH --mail-type=ALL... (1 Reply)
Discussion started by: @man
1 Replies

2. Shell Programming and Scripting

[Solved] Multiple input files and output files

Hi, I have many test*.ft1 files to which I want to read as input for a script called pipe2txt.tcl and print the output in each separate file. For example, pipe2txt.tcl < test001.ft1 > test001.txt How can I read many files in this maner? thank you very much, Best, Pahuja (5 Replies)
Discussion started by: Pahuja
5 Replies

3. Shell Programming and Scripting

Script to unzip files and Rename the Output-files

Hi all, I have a many folders with zipped files in them. The zipped files are txt files from different folders. The txt files have the same names. If i try to find . -type f -name "*.zip" -exec cp -R {} /myhome/ZIP \; it fails since the ZIP files from different folders have the same names and... (2 Replies)
Discussion started by: pmkenya
2 Replies

4. Shell Programming and Scripting

Compare files and share output from both files

hi all, Thanks to all for your great help... I have a scenario that I have two files (file1 & file2). I need to compare two files entire row by row and share the output if any discrepancies within two files. File1: DB1|TB1|C1,C3 DB2|TB2|C1,C2 DB3|TB3|C1,C2,C3,C4 File2: ... (2 Replies)
Discussion started by: Selva_2507
2 Replies

5. UNIX for Dummies Questions & Answers

Using AWK: Extract data from multiple files and output to multiple new files

Hi, I'd like to process multiple files. For example: file1.txt file2.txt file3.txt Each file contains several lines of data. I want to extract a piece of data and output it to a new file. file1.txt ----> newfile1.txt file2.txt ----> newfile2.txt file3.txt ----> newfile3.txt Here is... (3 Replies)
Discussion started by: Liverpaul09
3 Replies

6. Shell Programming and Scripting

compare files in two directories and output changed files to third directory

I have searched about 30 threads, a load of Google pages and cannot find what I am looking for. I have some of the parts but not the whole. I cannot seem to get the puzzle fit together. I have three folders, two of which contain different versions of multiple files, dist/file1.php dist/file2.php... (4 Replies)
Discussion started by: bkeep
4 Replies

7. Shell Programming and Scripting

I need a script to find socials in files and output a list of those files

I am trying to find socail security numbers in files in (and under) a specific directory and output a list of the files where they are found... the format would be with no dashes just 9 numeric characters in a row. I have tried this: find /DirToLookIn -exec grep '\{9\}' /dev/null {} \; >>... (1 Reply)
Discussion started by: NewSolarisAdmin
1 Replies

8. Shell Programming and Scripting

comparing of two files with output which is not in both files

Hi I am having two files... x1 709545 709546 709547 and x2 709545 709545 709545 the output should be 709546 709547 pls help (2 Replies)
Discussion started by: suryanarayana
2 Replies

9. UNIX for Dummies Questions & Answers

eps or ps output files

I am writing a text for LaTeX compile. I think that my grace figs need to be .ps or .eps files for incorporation. Can one just do a 'save as X.eps' for this, or is another method required? Thanks- Marshall (6 Replies)
Discussion started by: blann
6 Replies

10. UNIX for Dummies Questions & Answers

split files into specified number of output files

Hi everyone, I have some large text files that I need to split into a specific number of files of equal size. As far as I know (and I don't really know that much :)) the split command only lets you specify the number of lines or bytes. The files are all of a different size, so the number of... (4 Replies)
Discussion started by: Migrainegirl
4 Replies
Login or Register to Ask a Question