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

NAME
cp1251 - CP 1251 character set encoded in octal, decimal, and hexadecimal DESCRIPTION
The Windows Code Pages include several 8-bit extensions to the ASCII character set (also known as ISO 646-IRV). CP 1251 encodes the char- acters used in Cyrillic scripts. The following table displays the characters in CP 1251, which are printable and unlisted in the ascii(7) manual page. The fourth column will only show the proper glyphs in an environment configured for CP 1251. Oct Dec Hex Char Description ---------------------------------------------------------------------- 200 128 80 CYRILLIC CAPITAL LETTER DJE 201 129 81 CYRILLIC CAPITAL LETTER GJE 202 130 82 , SINGLE LOW-9 QUOTATION MARK 203 131 83 CYRILLIC SMALL LETTER GJE 204 132 84 ,, DOUBLE LOW-9 QUOTATION MARK 205 133 85 HORIZONTAL ELLIPSIS 206 134 86 - DAGGER 207 135 87 = DOUBLE DAGGER 210 136 88 EUR EURO SIGN 211 137 89 %o PER MILLE SIGN 212 138 8A CYRILLIC CAPITAL LETTER LJE 213 139 8B < SINGLE LEFT-POINTING ANGLE QUOTATION MARK 214 140 8C CYRILLIC CAPITAL LETTER NJE 215 141 8D CYRILLIC CAPITAL LETTER KJE 216 142 8E CYRILLIC CAPITAL LETTER TSHE 217 143 8F CYRILLIC CAPITAL LETTER DZHE 220 144 90 CYRILLIC SMALL LETTER DJE 221 145 91 ' LEFT SINGLE QUOTATION MARK 222 146 92 ' RIGHT SINGLE QUOTATION MARK 223 147 93 " LEFT DOUBLE QUOTATION MARK 224 148 94 " RIGHT DOUBLE QUOTATION MARK 225 149 95 o BULLET 226 150 96 - EN DASH 227 151 97 -- EM DASH 230 152 98 UNDEFINED 231 153 99 tm TRADE MARK SIGN 232 154 9A CYRILLIC SMALL LETTER LJE 233 155 9B > SINGLE RIGHT-POINTING ANGLE QUOTATION MARK 234 156 9C CYRILLIC SMALL LETTER NJE 235 157 9D CYRILLIC SMALL LETTER KJE 236 158 9E CYRILLIC SMALL LETTER TSHE 237 159 9F CYRILLIC SMALL LETTER DZHE 240 160 A0 NO-BREAK SPACE 241 161 A1 CYRILLIC CAPITAL LETTER SHORT U 242 162 A2 CYRILLIC SMALL LETTER SHORT U 243 163 A3 CYRILLIC CAPITAL LETTER JE 244 164 A4 x CURRENCY SIGN 245 165 A5 CYRILLIC CAPITAL LETTER GHE WITH UPTURN 246 166 A6 | BROKEN BAR 247 167 A7 S SECTION SIGN 250 168 A8 CYRILLIC CAPITAL LETTER IO 251 169 A9 (C) COPYRIGHT SIGN 252 170 AA CYRILLIC CAPITAL LETTER UKRAINIAN IE 253 171 AB << LEFT-POINTING DOUBLE ANGLE QUOTATION MARK 254 172 AC ~ NOT SIGN 255 173 AD SOFT HYPHEN 256 174 AE (R) REGISTERED SIGN 257 175 AF CYRILLIC CAPITAL LETTER YI 260 176 B0 o DEGREE SIGN 261 177 B1 +- PLUS-MINUS SIGN 262 178 B2 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I 263 179 B3 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I 264 180 B4 CYRILLIC SMALL LETTER GHE WITH UPTURN 265 181 B5 u MICRO SIGN 266 182 B6 9| PILCROW SIGN 267 183 B7 . MIDDLE DOT 270 184 B8 CYRILLIC SMALL LETTER IO 271 185 B9 NUMERO SIGN 272 186 BA CYRILLIC SMALL LETTER UKRAINIAN IE 273 187 BB >> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK 274 188 BC CYRILLIC SMALL LETTER JE 275 189 BD CYRILLIC CAPITAL LETTER DZE 276 190 BE CYRILLIC SMALL LETTER DZE 277 191 BF CYRILLIC SMALL LETTER YI 300 192 C0 CYRILLIC CAPITAL LETTER A 301 193 C1 CYRILLIC CAPITAL LETTER BE 302 194 C2 CYRILLIC CAPITAL LETTER VE 303 195 C3 CYRILLIC CAPITAL LETTER GHE 304 196 C4 CYRILLIC CAPITAL LETTER DE 305 197 C5 CYRILLIC CAPITAL LETTER IE 306 198 C6 CYRILLIC CAPITAL LETTER ZHE 307 199 C7 v CYRILLIC CAPITAL LETTER ZE 310 200 C8 CYRILLIC CAPITAL LETTER I 311 201 C9 CYRILLIC CAPITAL LETTER SHORT I 312 202 CA CYRILLIC CAPITAL LETTER KA 313 203 CB CYRILLIC CAPITAL LETTER EL 314 204 CC CYRILLIC CAPITAL LETTER EM 315 205 CD CYRILLIC CAPITAL LETTER EN 316 206 CE CYRILLIC CAPITAL LETTER O 317 207 CF CYRILLIC CAPITAL LETTER PE 320 208 D0 CYRILLIC CAPITAL LETTER ER 321 209 D1 CYRILLIC CAPITAL LETTER ES 322 210 D2 CYRILLIC CAPITAL LETTER TE 323 211 D3 CYRILLIC CAPITAL LETTER U 324 212 D4 CYRILLIC CAPITAL LETTER EF 325 213 D5 CYRILLIC CAPITAL LETTER HA 326 214 D6 CYRILLIC CAPITAL LETTER TSE 327 215 D7 CYRILLIC CAPITAL LETTER CHE 330 216 D8 CYRILLIC CAPITAL LETTER SHA 331 217 D9 CYRILLIC CAPITAL LETTER SHCHA 332 218 DA CYRILLIC CAPITAL LETTER HARD SIGN 333 219 DB CYRILLIC CAPITAL LETTER YERU 334 220 DC CYRILLIC CAPITAL LETTER SOFT SIGN 335 221 DD CYRILLIC CAPITAL LETTER E 336 222 DE CYRILLIC CAPITAL LETTER YU 337 223 DF CYRILLIC CAPITAL LETTER YA 340 224 E0 CYRILLIC SMALL LETTER A 341 225 E1 CYRILLIC SMALL LETTER BE 342 226 E2 CYRILLIC SMALL LETTER VE 343 227 E3 CYRILLIC SMALL LETTER GHE 344 228 E4 CYRILLIC SMALL LETTER DE 345 229 E5 CYRILLIC SMALL LETTER IE 346 230 E6 CYRILLIC SMALL LETTER ZHE 347 231 E7 CYRILLIC SMALL LETTER ZE 350 232 E8 CYRILLIC SMALL LETTER I 351 233 E9 CYRILLIC SMALL LETTER SHORT I 352 234 EA CYRILLIC SMALL LETTER KA 353 235 EB CYRILLIC SMALL LETTER EL 354 236 EC CYRILLIC SMALL LETTER EM 355 237 ED CYRILLIC SMALL LETTER EN 356 238 EE CYRILLIC SMALL LETTER O 357 239 EF CYRILLIC SMALL LETTER PE 360 240 F0 CYRILLIC SMALL LETTER ER 361 241 F1 CYRILLIC SMALL LETTER ES 362 242 F2 CYRILLIC SMALL LETTER TE 363 243 F3 CYRILLIC SMALL LETTER U 364 244 F4 CYRILLIC SMALL LETTER EF 365 245 F5 CYRILLIC SMALL LETTER HA 366 246 F6 CYRILLIC SMALL LETTER TSE 367 247 F7 CYRILLIC SMALL LETTER CHE 370 248 F8 CYRILLIC SMALL LETTER SHA 371 249 F9 CYRILLIC SMALL LETTER SHCHA 372 250 FA CYRILLIC SMALL LETTER HARD SIGN 373 251 FB CYRILLIC SMALL LETTER YERU 374 252 FC CYRILLIC SMALL LETTER SOFT SIGN 375 253 FD CYRILLIC SMALL LETTER E 376 254 FE CYRILLIC SMALL LETTER YU 377 255 FF CYRILLIC SMALL LETTER YA NOTES
CP 1251 is also known as Windows Cyrillic. SEE ALSO
ascii(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2010-09-20 CP1251(7)
All times are GMT -4. The time now is 10:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy