Combines all lines in two files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Combines all lines in two files
# 1  
Old 04-18-2015
Combines all lines in two files

The below awk combines the target.txt with the out_parse.txt and the output is GJ-53.txt (all attached). If there are multiple lines in out_parse how can they both be writing to GJ-53.txt?

Code:
For example, in out_parse.txt there are two lines: 
13	20763612	20763612	C	T
13	20763620	20763620	A	G but only the first writes to GJ-53.txt

Code:
cd 'C:\Users\cmccabe\Desktop\annovar'
	awk '{close(fname)} (getline fname<f)>0 {print>fname}' f=target.txt out_parse.txt

Thank you Smilie.
# 2  
Old 04-18-2015
Try:
Code:
cp out_parse.txt "$(cat target.txt)"


Last edited by Scrutinizer; 04-18-2015 at 01:21 PM..
This User Gave Thanks to Scrutinizer For This Post:
# 3  
Old 04-18-2015
Thank you Smilie.... works great.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to print lines from a files with specific start and end patterns and pick only the last lines?

Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" . I have attached sample input file and the desired input should be as: INPUT FORMAT: SELECT ABCD, DEFGH, DFGHJ, JKLMN, AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies

2. Shell Programming and Scripting

How to find files containing two specific lines and delate those lines?

Hi I need to find files in a specified folder where are two specified lines of text and delate that lines. It looks like this" 35. ?>NL 36. <iframe>.......</iframe>NLThe problem is that "?>" is in the other lines and id should not be removed if the next line is not like "<iframe>....." So... (4 Replies)
Discussion started by: androwida
4 Replies

3. Shell Programming and Scripting

Print n lines from top and n lines from bottom of all files with .log extenstion

Oracle Linux 6.4 In a directory I have more than 300 files with the extension .log I want the first 5 and last 5 lines of these .log files to be printed on screen with each file's name. Expected output : Printing first 5 and last 5 lines of FX_WT_Feb8_2014.log !! Authentication... (7 Replies)
Discussion started by: kraljic
7 Replies

4. Shell Programming and Scripting

Two files, remove lines from second based on lines in first

I have two files, a keepout.txt and a database.csv. They're unsorted, but could be sorted. keepout: user1 buser3 anuser19 notheruser27 database: user1,2343,"information about",field,blah,34 user2,4231,"mo info",etc,stuff,43 notheruser27,4344,"hiya",thing,more thing,423... (4 Replies)
Discussion started by: esoffron
4 Replies

5. UNIX for Advanced & Expert Users

SQL script with 86000 lines: new files with only 10000 lines (per file)

Hi this is my SQL script $ wc -l insert_into_customers.sql 85601 insert_into_customers.sqlI wish to cut this file into 9 files each 10000 lines (the last one less) $ wc -l insert_into_customers_00*.sql 10000 insert_into_customers_001.sql 10000 insert_into_customers_002.sql ... (1 Reply)
Discussion started by: slashdotweenie
1 Replies

6. Shell Programming and Scripting

merging two .txt files by alternating x lines from file 1 and y lines from file2

Hi everyone, I have two files (A and B) and want to combine them to one by always taking 10 rows from file A and subsequently 6 lines from file B. This process shall be repeated 40 times (file A = 400 lines; file B = 240 lines). Does anybody have an idea how to do that using perl, awk or sed?... (6 Replies)
Discussion started by: ink_LE
6 Replies

7. Shell Programming and Scripting

need to delete all lines from a group of files except the 1st 2 lines

Hello, I have a group of text files with many lines in each file. I need to delete all the lines in each and only leave 2 lines in each file. (3 Replies)
Discussion started by: script_op2a
3 Replies

8. UNIX for Dummies Questions & Answers

Shell Script that identifies changes between 2 files and then combines them

Hi, I've been trying to figure out a script that would enable me to find the changes made from an original file say x then to a duplicate called y then revert those changes. Simple, but I'm already cracking my head over this one, Can someone help me out? say file x:- abc1 def2 ghi3... (7 Replies)
Discussion started by: rahzzbietel
7 Replies

9. Shell Programming and Scripting

How to delete first 5 lines and last five lines in all text files

Hi I want to delete first five and last five lines in text files without opening the file and also i want to keep the same file name for all the files. Thanks in advance!!! Ragav (10 Replies)
Discussion started by: ragavendran31
10 Replies
Login or Register to Ask a Question