arrange merged data using sed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting arrange merged data using sed
# 1  
Old 12-16-2010
arrange merged data using sed

hi,

i used paste file1.txt file2.txt > file3.txt to merge 2 columns from file1 and 4 columns from file2.

file1
Code:
scaffold_217         scaffold_217

file2
Code:
CHRSM    N    scaffold_217.pf    scaffold_217.fsa

the result is as follows:-
Code:
scaffold_217    scaffold_217     
        CHRSM    N    scaffold_217.pf    scaffold_217.fsa


however, i need output like this (in 1 row separated by tab) like below:
Code:
scaffold_217    scaffold_217     CHRSM    N    scaffold_217.pf    scaffold_217.fsa

How to do this using sed or awk? would appreciate your help on this. thanks

Last edited by Scott; 12-16-2010 at 04:38 PM.. Reason: Please use code tags
# 2  
Old 12-16-2010
Code:
paste -d "\t" file1 file2 > file4


Last edited by Scott; 12-16-2010 at 04:38 PM..
# 3  
Old 12-16-2010
i tried..it didn't work Smilie
# 4  
Old 12-16-2010
It works fine for me. What doesn't work about it?

Can you post the output of:
Code:
od -c file1.txt
od -c file2.txt

# 5  
Old 12-16-2010
Code:
$ awk 1 ORS=\\t file1 file2

# 6  
Old 12-16-2010
Quote:
Originally Posted by cabrao
Code:
$ awk 1 ORS=\\t file1 file2

That just chucks everything out on a single line. Not really what paste is meant to do, I think in the context of this thread.
# 7  
Old 12-16-2010
It's true scottn.
Anyway, my post was just meant to the provided file Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed command to arrange words

Hi I have a text file as given below: Input format I have a text file as given below . This is a (9 Replies)
Discussion started by: my_Perl
9 Replies

2. Shell Programming and Scripting

Arrange data in table

Hello All, I have following data into my file named record. Name City phone number email Jhon Newyork 123456987 jhon@gmail.com Maria Texas 569865612 Maria_Sweet@rediffmail.com Chan Durben NA Chan123@gmail.com The output should be in straight columns.. There should not be any... (1 Reply)
Discussion started by: Nakul_sh
1 Replies

3. Shell Programming and Scripting

Arrange data in table

Hello All, I have following data into my file named record. Name City phone number email Jhon Newyork 123456987 jhon@gmail.com Maria Texas 569865612 Maria_Sweet@rediffmail.com Chan Durben NA Chan123@gmail.com |---------------------------------------------------------------| |Name ... (2 Replies)
Discussion started by: Nakul_sh
2 Replies

4. Shell Programming and Scripting

Arrange same data in same column ....

I have vary complex issue in unix...i want copy same data in same column... My Input... Object SpchAccate hAes hCCS SDop Sroontb NoRabEt SRbuc ran=C515D (Mod=15) 0 100 98.1 1.9 0.6 ... (7 Replies)
Discussion started by: asavaliya
7 Replies

5. Shell Programming and Scripting

Arrange / format data using awk

Input 217:fngadi4osa:fngadi4osa:M 217:415744:N/A 227:fngadi4osa:fngadi4osa: M 227:51200:N/A 228:fngadi4osa:fngadi4osa: M 228:102400:N/A 65:sapgt04:sapgt04: M 65:104448:N/A 228:fngadi4osa:fngadi4oma: M 228:102400:N/A Output 217:fngadi4osa:fngadi4osa:M 217:415744:N/A... (3 Replies)
Discussion started by: greycells
3 Replies

6. UNIX for Dummies Questions & Answers

Extract Data and arrange it based on timelines

Hi Im trying to extract a specific pattern of data from a log file and store it in a other file, Im executing the below command in various files and storing it in a single file. I data that Im storing needs to be arranged based on a date and timestamp. Please assist, how to achieve this. Thanks... (1 Reply)
Discussion started by: vr3w3c9
1 Replies

7. Shell Programming and Scripting

Arrange Data in table and send by mail

Everybody, can you tell me how express about this; we have text data file as : parameter1 Parameter2 AA 55 BB 77 . . . . . . We want to draw table for this data as attached then send as body of Email (4 Replies)
Discussion started by: xjklop2009
4 Replies

8. UNIX for Dummies Questions & Answers

Arrange data

I have a following data: 100 200 300 400 I want the data to be arranged: 100 200 300 400 What is the best way to do this? Thanks! (5 Replies)
Discussion started by: bobo
5 Replies

9. Shell Programming and Scripting

arrange data tools

Which is the best command(s) to arrange data of a file? This is my example input file: Tom ------ apples: 5 oranges: 7 pears: 10 apples: 2 oranges: 8 Jack ------ apples: 3 pears: 10 Lucy ------ oranges: 1 pears: 8 peaches: 9 Tom ------ peaches: 1 Jack ------ (1 Reply)
Discussion started by: csecnarf
1 Replies

10. Shell Programming and Scripting

re arrange data

Any idea in awk or sed? $cat file a b c 2 4 5 6 output: a b c 2 4 5 6 (3 Replies)
Discussion started by: kenshinhimura
3 Replies
Login or Register to Ask a Question