Help with re-organization data


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with re-organization data
# 1  
Help with re-organization data

Input file
Code:
DATA2.2 POSITION_152486.2     COLUMN689699.2
DATA2.2 ROW00000342066 UNIT00000342313
DATA7.2 POSITION_017891.4     COLUMN060361.4
DATA7.2 ROW00000379319 UNIT00000368623
DATA7.2 ROW00000421241 UNIT00000400736
DATA8.1 POSITION_153254.2     COLUMN694986.2
DATA8.1 ROW00000379288 UNIT00000368590
DATA8.1 POSITION_148901.1     COLUMN683699.1
DATA8.1 POSITION_148901.1     COLUMN683699.1
DATA9.1 ROW00000328596 UNIT00000328207
.

Desired output file:
Code:
DATA2.2 POSITION_152486.2     COLUMN689699.2	ROW00000342066 UNIT00000342313
DATA7.2 POSITION_017891.4     COLUMN060361.4	ROW00000379319 UNIT00000368623	ROW00000421241 UNIT00000400736
DATA8.1 POSITION_153254.2     COLUMN694986.2	ROW00000379288 UNIT00000368590	POSITION_148901.1     COLUMN683699.1	POSITION_148901.1     COLUMN683699.1
DATA9.1 ROW00000328596 UNIT00000328207
.

I have long list of input file and would like to merge those share the content in column 1 become one line instead of multiple lines.
Any command is appreciate.
Many thanks.
# 2  
awk,
Code:
awk '{if(a==$1){$1="";printf FS $0}else{a=$1;printf "\n%sFS",$0}}' filename

OR
Code:
awk 'a==$1{$1="";printf FS $0;next} {a=$1;printf NR==1?"%sFS":"\n%sFS",$0} END {printf "\n"}' filename


Last edited by pravin27; 07-14-2011 at 06:36 AM..
This User Gave Thanks to pravin27 For This Post:
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #533
Difficulty: Easy
A Boolean is type of variable that is used to hold a truth value, either true or false.
True or False?

8 More Discussions You Might Find Interesting

1. AIX

Help in understanding how backup and restore works in any organization?

Please take your time to answer/comment. no urgency. it would help upcoming sysadmins like me in understanding how things work in real time. OS: AIX Middleware: Weblogic/WAS Database: Oracle DB/IBM DB2 Backup s/w tools: not available as of now (except native OS commands/utilities) I'm a... (5 Replies)
Discussion started by: aaron8667
5 Replies

2. UNIX for Dummies Questions & Answers

Recursive file organization?

Does anyone have any idea of how I can make something like the code below run recursively? I'll run it on a tree of directories all with different names and all containing a sequence of .dpx files. I've tried to do it using find and exec but can't get it to work right. What it needs to do is... (4 Replies)
Discussion started by: scribling
4 Replies

3. Shell Programming and Scripting

mail outside organization

Hi All, Through mailx command, we are able to send mail to all users within the organization but not outside the organization. I need to work with Admin to configure it. Can someone tell me on what are the things needs be done to enable it. i have checked the resolv.conf, it shows only... (1 Reply)
Discussion started by: ace_friends22
1 Replies

4. Shell Programming and Scripting

Organization data based on two conditions applied problem asking...

Input file: HS04636 type header 836 7001 ID=g1 HS04636 type status 836 1017 Parent=g1.t1 HS04636 type location 966 1017 ID=g1.t1.cds;Parent=g1.t1 HS04636 type location 1818 1934 ID=g1.t1.cds;Parent=g1.t1 HS04636 type status 1818... (8 Replies)
Discussion started by: patrick87
8 Replies

5. IP Networking

Using 'whois' to Retrieve all IPs/Subnets for an Organization

I manage a spam filter for the organization I work for. I've been trying to get the others here to stop white listing by domain name since that can be easily spoofed. One of the obstacles, however, is that there doesn't seem to be an easy way to determine the legitimate outgoing SMTP server IP... (0 Replies)
Discussion started by: deckard
0 Replies

6. UNIX for Dummies Questions & Answers

File organization, /bin and /src

The /src file is obviously designed to contain source code, so when I download programs, I should put them in /src (because they contain the source files + the executables)? What do most people do with the executables? Do they copy them to /bin, make links to them in /bin, or just leave them in... (4 Replies)
Discussion started by: css136
4 Replies

7. UNIX for Dummies Questions & Answers

Theory question about the organization of a UNIX file...

Hi, I am quite sure that I am posting a question in the very wrong forum but I have to give a try. It's a question about UNIX theory. I don't have any clue of how to solve this question. If someone could kindly provide some good references or give me the formulas, it will be really... (1 Reply)
Discussion started by: ti_ma
1 Replies

8. AIX

Organization in a big file system

hello I have a file system with 737 Go of data (oracle) I want to add 230 Go. IBM technician says to me that it's better (for performance) to backup the file system, rebuild it with the new 250Go and restore it.... 737 Go to backup, it is not very simple... !!!! You confirm what says the... (6 Replies)
Discussion started by: pascalbout
6 Replies

Featured Tech Videos