Inserting a column from one file into another big file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Inserting a column from one file into another big file
# 1  
Old 05-21-2009
Inserting a column from one file into another big file

Hi

I have two files, one is 1.6 GB. I would like to add one extra column of information to the large file at a specific location (after its 2nd column).

For example:

File 1 has two columns more than 1000 rows like this

MM009987 1

File 2 looks like this

MM00098 MM00076 3 4 2 4 2 1 3 2 1 2 4 3 1 2 4 2 1 3 4 1 3 4 ....etc

I would like to insert the 2nd column from File 1 after the 2nd column of File 2

Thank you for any help on this!

(I already posted this, but I don't see it listed in the new posts. So, I'm submitting it again)

# 2  
Old 05-22-2009
is your file1 and file2 contain same no of lines??
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inserting IDs from a text file into a sequence alignment file

Hi, I have one file with one column and several hundred entries File1: NA1 NA2 NA3And now I need to run a command within a mapping aligner tool to insert these sample names into a sequence alignment file (SAM) such that they look like this @RG ID:Library1 SM:NA1 PL:Illumina ... (7 Replies)
Discussion started by: nans
7 Replies

2. UNIX for Dummies Questions & Answers

Inserting a column into a text file

I have a tab delimited text file with multiple columns (data.txt). I would like to insert a column into the text file. The column I want to insert is in a text file (column.txt). I want to insert it into the 5th column of data.txt. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

3. Shell Programming and Scripting

parsing data from a big file using keys from another smaller file

Hi, I have 2 files format of file 1 is: a1 b2 a2 c2 d1 f3 format of file 2 is (tab delimited): a1 1.2 0.5 0.06 0.7 0.9 1 0.023 a3 0.91 0.007 0.12 0.34 0.45 1 0.7 a2 1.05 2.3 0.25 1 0.9 0.3 0.091 b1 1 5.4 0.3 9.2 0.3 0.2 0.1 b2 3 5 7 0.9 1 9 0 1 b3 0.001 1 2.3 4.6 8.9 10 0 1 0... (10 Replies)
Discussion started by: Lucky Ali
10 Replies

4. Shell Programming and Scripting

awk column comparison big file

Hi all, I would like to compare a column in one file to a column in another file and when there is a match it prints the first column and the corresponding second column. Example File1 ABA ABC ABE ABF File 2 ABA 123 ABB 124 ABD 125 ABC 126 So what I would like printed to a... (6 Replies)
Discussion started by: pcg
6 Replies

5. UNIX for Dummies Questions & Answers

How big is too big a config.log file?

I have a 5000 line config.log file with several "maybe" errors. Any reccomendations on finding solvable problems? (2 Replies)
Discussion started by: NeedLotsofHelp
2 Replies

6. Ubuntu

Inserting a header with column number to a 1.6 GB file with special spacing

Hi; I've been searching posts to find a solution to what I'm trying to do, but I've have NOT found anything yet. I have a file (file1) with 300K columns and 1411 rows, the columns don't have a column no. header (No header at all) and I'm trying to fetch the information from specific columns.... (3 Replies)
Discussion started by: sogi
3 Replies

7. Shell Programming and Scripting

gawk help for inserting a field of a .txt file in the same file

i had the following type of data file vchrdump: Vouchers For Date :05/01/2009 * ... (4 Replies)
Discussion started by: KANNI786
4 Replies

8. Shell Programming and Scripting

Inserting a column in a file

Hi I have the following info in a file file1 ABCD DSFD sdfsd YUISA I want to add a column to the file file1 like the below. STR ABCD STR DSFD STR sdfsd STR YUISA Is there any way in sed or awk to do it. Regards Dhana (7 Replies)
Discussion started by: dhanamurthy
7 Replies

9. UNIX for Advanced & Expert Users

Inserting a new column in a file

Hey.. I'm writing a code to download some stuff from Informix database and put it on Xls. It works fine, but I have a problem fitting in a new requirement. I have currently a file which has information like below. f_name|Ronnie|Johnson|23.00| f_sal|Ronnie|Jhonson|4000.00|... (4 Replies)
Discussion started by: rosh0623
4 Replies

10. UNIX for Dummies Questions & Answers

How to view a big file(143M big)

1 . Thanks everyone who read the post first. 2 . I have a log file which size is 143M , I can not use vi open it .I can not use xedit open it too. How to view it ? If I want to view 200-300 ,how can I implement it 3 . Thanks (3 Replies)
Discussion started by: chenhao_no1
3 Replies
Login or Register to Ask a Question