Sponsored Content
Top Forums Shell Programming and Scripting Columns vs. columns in same file Post 302784363 by busyboy on Friday 22nd of March 2013 04:24:16 AM
Old 03-22-2013
Columns vs. columns in same file

I'm trying to consolidate the below given input

Code:
ID    TIMEFRAME 
193 18:30:0:390
177 18:30:0:605
180 18:30:0:710
215 18:30:0:690
165 18:30:0:580
195 18:30:0:170
252 18:30:0:185
198 18:30:0:265
246 18:30:0:370
183 18:30:0:330
225 18:30:0:110
173 18:30:0:220
66 18:30:0:790
248 18:30:0:545
186 18:30:0:600
244 18:30:0:65
240 18:30:0:10
245 18:30:0:170
44 18:30:0:565
178 18:30:0:305
218 18:30:0:700
168 18:30:0:110
213 18:30:0:225
199 18:30:0:255
206 18:30:0:145
135 18:30:0:250
12 18:30:0:130
209 18:30:0:45
222 18:30:0:275
188 18:30:0:55
11 18:30:0:545
174 18:30:0:360
208 18:30:0:635
152 18:30:0:15
146 18:30:0:655
35 18:30:0:700
78 18:30:0:130
50 18:30:0:340
167 18:30:0:930
184 18:30:0:600
191 18:30:0:545
219 18:30:0:390
76 18:30:0:150
23 18:30:0:560
39 18:30:0:345
200 18:30:0:885
60 18:30:0:175
88 18:30:0:770
116 18:30:0:250
85 18:30:0:985
33 18:30:0:725
211 18:30:0:825
98 18:30:0:635
229 18:30:0:475
164 18:30:0:55
250 18:30:0:305
190 18:30:0:330
144 18:30:0:540
216 18:30:0:810
217 18:30:0:260
129 18:30:0:120
147 18:30:0:500
166 18:30:0:640
117 18:30:0:700
145 18:30:0:665
91 18:30:0:550
140 18:30:0:105
104 18:30:0:430
68 18:30:0:585
2 18:30:0:625
251 18:30:0:490
197 18:30:0:730
4 18:30:0:175
40 18:30:0:720
156 18:30:0:860
94 18:30:0:310
110 18:30:0:955
221 18:30:0:690
137 18:30:0:20
31 18:30:0:660
189 18:30:0:230
16 18:30:0:20
187 18:30:0:485
27 18:30:0:985
176 18:30:0:405
175 18:30:0:990
210 18:30:0:625
30 18:30:0:20
42 18:30:0:510
28 18:30:0:275
109 18:30:0:770
69 18:30:0:435
243 18:30:0:415
120 18:30:0:545
138 18:30:0:735
80 18:30:0:870
121 18:30:0:255
22 18:30:0:850
162 18:30:0:455
212 18:30:0:295
142 18:30:0:195
172 18:30:0:570
105 18:30:0:480
202 18:30:0:345
133 18:30:0:950
81 18:30:0:920
103 18:30:0:630
157 18:30:0:940
79 18:30:0:60
132 18:30:0:775
54 18:30:0:680
123 18:30:0:55
223 18:30:0:740
96 18:30:0:55
160 18:30:0:90
82 18:30:0:880
41 18:30:0:150
86 18:30:0:345
101 18:30:0:460
119 18:30:0:20
102 18:30:0:225
38 18:30:0:385
3 18:30:0:315
113 18:30:0:265
43 18:30:0:50
67 18:30:0:915
249 18:30:0:415
5 18:30:0:265
126 18:30:0:660
13 18:30:0:415
214 18:30:0:640
106 18:30:0:970
6 18:30:0:540
58 18:30:0:830
48 18:30:0:895

to

Code:
67 TIMEFRAME1 TIMEFRAME2 TIMEFRAME3 ....TIMEFRAME-N COUNT(TIMEFRAMES per ID)

I'm trying with this code from awk, but somehow, the TIMEFRAMEs are note Sorted and IDs are repetitive.

Code:
awk 'BEGIN { x=0; } /NE Id/ { NEID[x++]=$14"|"$18;  } END { for(i in NEID) {split(NEID[i],b,"|");  if(b[1] in NEID) {NEARR[b[1]]=NEARR[b[1]]" "b[2];  }  } for (k in NEARR) { print NEARR[k] } } '


Last edited by busyboy; 03-22-2013 at 05:49 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sum of three columns - in 4N columns file

Hi All, happy new year. I have a file with 4xN columns like 0.0000e+00 0.0000e+00 7.199E+07 7.123E+07 6.976E+07 6.482E+07 5.256E+07 2.523E+07 0.0000e+00 0.0000e+00 8.641E+07 8.550E+07 8.373E+07 7.780E+07 6.309E+07 3.028E+07... (8 Replies)
Discussion started by: f_o_555
8 Replies

2. Shell Programming and Scripting

Single command for add 2 columns and remove 2 columns in unix/performance tuning

Hi all, I have created a script which adding two columns and removing two columns for all files. Filename: Cust_information_1200_201010.txt Source Data: "1","Cust information","123","106001","street","1-203 high street" "1","Cust information","124","105001","street","1-203 high street" ... (0 Replies)
Discussion started by: onesuri
0 Replies

3. Shell Programming and Scripting

Replace specific columns in one file with columns in another file

HELLO! This is my first post here! By the way, I think it is great that people do this. My question: I have two files, one is a .dilm and one is a .txt. It is my understanding that the .dilm file can be treated as a .txt file. I wrote another program where I was able to manipulate it as if it... (3 Replies)
Discussion started by: mehdib
3 Replies

4. UNIX for Dummies Questions & Answers

Removing columns from a text file that do not have any values in second and third columns

I have a text file that has three columns. But at the end of the text file, there are trailing lines that have missing second and third columns: 4 0.04972604 KLHL28 4 0.0497332 CSTB 4 0.04979822 AIF1 4 0.04983331 DECR2 4 0.04990344 KATNB1 4 4 4 4 How can I remove the trailing... (3 Replies)
Discussion started by: evelibertine
3 Replies

5. UNIX for Advanced & Expert Users

Help in Deleting columns and Renaming Mutliple columns in a .Csv File

Hi All, i have a .Csv file in the below format startTime, endTime, delta, gName, rName, rNumber, m2239max, m2239min, m2239avg, m100016509avg, m100019240max, metric3min, m100019240avg, propValues 11-Mar-2012 00:00:00, 11-Mar-2012 00:05:00, 300.0, vma3550a, a-1_CPU Index<1>, 200237463, 0.0,... (9 Replies)
Discussion started by: mahi_mayu069
9 Replies

6. Shell Programming and Scripting

Combine columns from many files but keep them aligned in columns-shorter left column issue

Hello everyone, I searched the forum looking for answers to this but I could not pinpoint exactly what I need as I keep having trouble. I have many files each having two columns and hundreds of rows. first column is a string (can have many words) and the second column is a number.The files are... (5 Replies)
Discussion started by: isildur1234
5 Replies

7. Shell Programming and Scripting

Deleting all the fields(columns) from a .csv file if all rows in that columns are blanks

Hi Friends, I have come across some files where some of the columns don not have data. Key, Data1,Data2,Data3,Data4,Data5 A,5,6,,10,, A,3,4,,3,, B,1,,4,5,, B,2,,3,4,, If we see the above data on Data5 column do not have any row got filled. So remove only that column(Here Data5) and... (4 Replies)
Discussion started by: ks_reddy
4 Replies

8. Shell Programming and Scripting

How to concatenate 2-columns by 2 -columns for a text file?

Hello, I want to concatenate 2-columns by 2-columns separated by colon. How can I do so? For example, I have a text file containing 6 columns separated by tab. I want to concatenate column 1 and 2; column 3 and 4; column 5 and 6, respectively, and put a colon in between. input file: 1 0 0 1... (10 Replies)
Discussion started by: huiyee1
10 Replies

9. Shell Programming and Scripting

Compare 2 csv files by columns, then extract certain columns of matcing rows

Hi all, I'm pretty much a newbie to UNIX. I would appreciate any help with UNIX coding on comparing two large csv files (greater than 10 GB in size), and output a file with matching columns. I want to compare file1 and file2 by 'id' and 'chain' columns, then extract exact matching rows'... (5 Replies)
Discussion started by: bkane3
5 Replies

10. Shell Programming and Scripting

Match Columns in one file and extract columns from another file

Kindly help merging information from two files with the following data structure. I want to match for the CHR-SNP in Foo and get the columns that match from CHROM-rsID Fields 1 & 2 of foo may have duplicates, however, a joint key of Fields $1$2$3$4 is unique. Also would be helpful to clean up... (4 Replies)
Discussion started by: genehunter
4 Replies
ppmtosixel(1)                                                 General Commands Manual                                                ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 07:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy