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
KOI8-R(7)						     Linux Programmer's Manual							 KOI8-R(7)

NAME
koi8-r - Russian character set encoded in octal, decimal, and hexadecimal DESCRIPTION
RFC 1489 defines an 8-bit character set, KOI8-R. KOI8-R encodes the characters used in Russian. KOI8-R characters The following table displays the characters in KOI8-R that are printable and unlisted in the ascii(7) manual page. Oct Dec Hex Char Description ------------------------------------------------------------------------ 200 128 80 BOX DRAWINGS LIGHT HORIZONTAL 201 129 81 | BOX DRAWINGS LIGHT VERTICAL 202 130 82 BOX DRAWINGS LIGHT DOWN AND RIGHT 203 131 83 BOX DRAWINGS LIGHT DOWN AND LEFT 204 132 84 BOX DRAWINGS LIGHT UP AND RIGHT 205 133 85 BOX DRAWINGS LIGHT UP AND LEFT 206 134 86 BOX DRAWINGS LIGHT VERTICAL AND RIGHT 207 135 87 BOX DRAWINGS LIGHT VERTICAL AND LEFT 210 136 88 BOX DRAWINGS LIGHT DOWN AND HORIZONTAL 211 137 89 BOX DRAWINGS LIGHT UP AND HORIZONTAL 212 138 8A BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL 213 139 8B UPPER HALF BLOCK 214 140 8C LOWER HALF BLOCK 215 141 8D FULL BLOCK 216 142 8E LEFT HALF BLOCK 217 143 8F RIGHT HALF BLOCK 220 144 90 LIGHT SHADE 221 145 91 MEDIUM SHADE 222 146 92 DARK SHADE 223 147 93 TOP HALF INTEGRAL 224 148 94 BLACK SQUARE 225 149 95 BULLET OPERATOR 226 150 96 / SQUARE ROOT 227 151 97 ~~ ALMOST EQUAL TO 230 152 98 <= LESS-THAN OR EQUAL TO 231 153 99 >= GREATER-THAN OR EQUAL TO 232 154 9A NO-BREAK SPACE 233 155 9B BOTTOM HALF INTEGRAL 234 156 9C o DEGREE SIGN 235 157 9D 2 SUPERSCRIPT TWO 236 158 9E . MIDDLE DOT 237 159 9F -:- DIVISION SIGN 240 160 A0 BOX DRAWINGS DOUBLE HORIZONTAL 241 161 A1 BOX DRAWINGS DOUBLE VERTICAL 242 162 A2 BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE 243 163 A3 CYRILLIC SMALL LETTER IO 244 164 A4 BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE 245 165 A5 BOX DRAWINGS DOUBLE DOWN AND RIGHT 246 166 A6 BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE 247 167 A7 BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE 250 168 A8 BOX DRAWINGS DOUBLE DOWN AND LEFT 251 169 A9 BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE 252 170 AA BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE 253 171 AB BOX DRAWINGS DOUBLE UP AND RIGHT 254 172 AC BOX DRAWINGS UP SINGLE AND LEFT DOUBLE 255 173 AD BOX DRAWINGS UP DOUBLE AND LEFT SINGLE 256 174 AE BOX DRAWINGS DOUBLE UP AND LEFT 257 175 AF BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE 260 176 B0 BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE 261 177 B1 BOX DRAWINGS DOUBLE VERTICAL AND RIGHT 262 178 B2 BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE 263 179 B3 CYRILLIC CAPITAL LETTER IO 264 180 B4 BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE 265 181 B5 BOX DRAWINGS DOUBLE VERTICAL AND LEFT 266 182 B6 BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE 267 183 B7 BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE 270 184 B8 BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL 271 185 B9 BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE 272 186 BA BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE 273 187 BB BOX DRAWINGS DOUBLE UP AND HORIZONTAL 274 188 BC BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE 275 189 BD BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE 276 190 BE BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL 277 191 BF (C) COPYRIGHT SIGN 300 192 C0 CYRILLIC SMALL LETTER YU 301 193 C1 CYRILLIC SMALL LETTER A 302 194 C2 CYRILLIC SMALL LETTER BE 303 195 C3 CYRILLIC SMALL LETTER TSE 304 196 C4 CYRILLIC SMALL LETTER DE 305 197 C5 CYRILLIC SMALL LETTER IE 306 198 C6 CYRILLIC SMALL LETTER EF 307 199 C7 CYRILLIC SMALL LETTER GHE 310 200 C8 CYRILLIC SMALL LETTER HA 311 201 C9 CYRILLIC SMALL LETTER I 312 202 CA CYRILLIC SMALL LETTER SHORT I 313 203 CB CYRILLIC SMALL LETTER KA 314 204 CC CYRILLIC SMALL LETTER EL 315 205 CD CYRILLIC SMALL LETTER EM 316 206 CE CYRILLIC SMALL LETTER EN 317 207 CF CYRILLIC SMALL LETTER O 320 208 D0 CYRILLIC SMALL LETTER PE 321 209 D1 CYRILLIC SMALL LETTER YA 322 210 D2 CYRILLIC SMALL LETTER ER 323 211 D3 CYRILLIC SMALL LETTER ES 324 212 D4 CYRILLIC SMALL LETTER TE 325 213 D5 CYRILLIC SMALL LETTER U 326 214 D6 CYRILLIC SMALL LETTER ZHE 327 215 D7 CYRILLIC SMALL LETTER VE 330 216 D8 CYRILLIC SMALL LETTER SOFT SIGN 331 217 D9 CYRILLIC SMALL LETTER YERU 332 218 DA CYRILLIC SMALL LETTER ZE 333 219 DB CYRILLIC SMALL LETTER SHA 334 220 DC CYRILLIC SMALL LETTER E 335 221 DD CYRILLIC SMALL LETTER SHCHA 336 222 DE CYRILLIC SMALL LETTER CHE 337 223 DF CYRILLIC SMALL LETTER HARD SIGN 340 224 E0 CYRILLIC CAPITAL LETTER YU 341 225 E1 CYRILLIC CAPITAL LETTER A 342 226 E2 CYRILLIC CAPITAL LETTER BE 343 227 E3 CYRILLIC CAPITAL LETTER TSE 344 228 E4 CYRILLIC CAPITAL LETTER DE 345 229 E5 CYRILLIC CAPITAL LETTER IE 346 230 E6 CYRILLIC CAPITAL LETTER EF 347 231 E7 CYRILLIC CAPITAL LETTER GHE 350 232 E8 CYRILLIC CAPITAL LETTER HA 351 233 E9 CYRILLIC CAPITAL LETTER I 352 234 EA CYRILLIC CAPITAL LETTER SHORT I 353 235 EB CYRILLIC CAPITAL LETTER KA 354 236 EC CYRILLIC CAPITAL LETTER EL 355 237 ED CYRILLIC CAPITAL LETTER EM 356 238 EE CYRILLIC CAPITAL LETTER EN 357 239 EF CYRILLIC CAPITAL LETTER O 360 240 F0 CYRILLIC CAPITAL LETTER PE 361 241 F1 CYRILLIC CAPITAL LETTER YA 362 242 F2 CYRILLIC CAPITAL LETTER ER 363 243 F3 CYRILLIC CAPITAL LETTER ES 364 244 F4 CYRILLIC CAPITAL LETTER TE 365 245 F5 CYRILLIC CAPITAL LETTER U 366 246 F6 CYRILLIC CAPITAL LETTER ZHE 367 247 F7 CYRILLIC CAPITAL LETTER VE 370 248 F8 CYRILLIC CAPITAL LETTER SOFT SIGN 371 249 F9 CYRILLIC CAPITAL LETTER YERU 372 250 FA CYRILLIC CAPITAL LETTER ZE 373 251 FB CYRILLIC CAPITAL LETTER SHA 374 252 FC CYRILLIC CAPITAL LETTER E 375 253 FD CYRILLIC CAPITAL LETTER SHCHA 376 254 FE CYRILLIC CAPITAL LETTER CHE 377 255 FF CYRILLIC CAPITAL LETTER HARD SIGN NOTES
The differences with KOI8-U are in the hex positions A4, A6, A7, AD, B4, B6, B7, and BD. SEE ALSO
ascii(7), charsets(7), cp1251(7), iso_8859-5(7), koi8-u(7), utf-8(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2016-07-17 KOI8-R(7)
All times are GMT -4. The time now is 01:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy