Sponsored Content
Top Forums Shell Programming and Scripting Concatenate rows and redefine range Post 302945916 by alex2005 on Thursday 4th of June 2015 05:51:44 PM
Old 06-04-2015
Concatenate rows and redefine range

I'm trying to find a way to concatenate consecutive rows (key is column $1 and $2) if column $5 an $6 are integers and redefine ranges in columns $3&$4 and $5&$6

Unfortunately I'm still learning the very basics so I cannot figure a way of doing this with awk.

Input file

Code:
15 30  21  21  25.0  25.0
15 30  22  22  26.0  26.0
15 30  23  23  27.0  27.0
15 30  24  24  28.5  28.5
15 30  25  25  29.7  29.7
15 30  26  26  30.0  30.0
15 30  27  27  31.0  31.0
17 32 155 155 325.0 325.0
17 32 156 156 326.3 326.3
17 32 158 158 424.0 424.0
17 32 159 159 425.0 425.0
17 32 160 160 426.0 426.0


Desired output:

Code:
15 30  21  23  25.0  27.0
15 30  24  24  28.5  28.5
15 30  25  25  29.7  29.7
15 30  26  27  30.0  31.0 
17 32 155 155 325.0 325.0
17 32 156 156 326.3 326.3
17 32 158 160 424.0 426.0

Thanks in advance!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Concatenate 2 rows into 1 row

I need to search a file for two values (valueA & valueB). ValueA will be on a different row than valueB, and concatenate the two together on the same row of my output. Example: search input file for strings "node" and "OS", combine the two results into one row input node A text text OS... (4 Replies)
Discussion started by: indianadoug
4 Replies

2. Shell Programming and Scripting

Concatenate rows in to 2 files

I have 2 files FILEA 1232342 1232342 2344767 4576823 2325642 FILEB 3472328 2347248 1237123 1232344 8787890 I want the output to go into a 3rd file and look like: FILEC 1232342 3472328 (1 Reply)
Discussion started by: unxusr123
1 Replies

3. Shell Programming and Scripting

concatenate two files with different No of rows

need a shell which perform following function file 1 ( every time new data comes) 1212 2323 3434 4545 5656 . . . . file 2 (fixed line) update bc_tbl set aix=data , bix=back where cix=U and serial=; now when i execute shell it will concatinate file 1, file 2 & make file 3 as... (3 Replies)
Discussion started by: The_Archer
3 Replies

4. Shell Programming and Scripting

Concatenate some of the rows...

i have a file as below and i need to load it into oracle. The problem is, some of the rows are in 2 lines. 123456_PosWlist ----- ----- IN 0/0 123456_PosWListRpt ----- ----- IN 0/0 123456_PosWListCSV ----- -----... (7 Replies)
Discussion started by: Amit.Sagpariya
7 Replies

5. Shell Programming and Scripting

delete rows between closest pattern or range

Hi I am having some problom deleting the lines between two specific lines in a file. need to delete lines between two closest lines. i.e need to find the closest range or pattern in a file with repeating patterns. Sample Input: WARNING <some text in n number of lines> ERROR:2597... (10 Replies)
Discussion started by: sudheer1984
10 Replies

6. UNIX for Dummies Questions & Answers

Read rows from source file and concatenate output

Hi guys; TBH I am an absolute novice, when it comes to scripting; I do have an idea of the basic commands... Here is my problem; I have a flatfile 'A' containing a single column with multiple rows. I have to create a script which will use 'A' as input and then output a string in in the... (0 Replies)
Discussion started by: carlos_anubis
0 Replies

7. Shell Programming and Scripting

Need help to read rows from one file and concatenate to another

Hi guys; TBH I am an absolute novice, when it comes to scripting; I do have an idea of the basic commands... Here is my problem; I have a flatfile 'A' containing a single column with multiple rows. I have to create a script which will use 'A' as input and then output a string in in the... (6 Replies)
Discussion started by: carlos_anubis
6 Replies

8. Shell Programming and Scripting

Sum of range of rows and columns in matrix

Hi all, I have a large matrix of 720 x 25. I want to get sum of range of rows and columns. Like, I need sum of all columns and row number 2 to 21, then leaving 22nd row, again sum of all columns and row number 23 to 42 again leaving 43rd row and then sum of 44th to 63. Means I want to add all... (4 Replies)
Discussion started by: CAch
4 Replies

9. Shell Programming and Scripting

Printing rows based on column range

Hello, I have a file with nearly 57K lines. I want to filter the lines based on the range of values in a column. For e.g. print lines whose 3rd filed is >=0.02. Input file: LOC_Os09g32030 LOC_Os02g18880 0.0200037219149773 undirected NA NA LOC_Os03g58630 LOC_Os09g35690 ... (1 Reply)
Discussion started by: Sanchari
1 Replies

10. Shell Programming and Scripting

Concatenate broken rows

I need to concatenate the rows that are broken (because of carriage return and line feed) in unix. Input 123|456|789|"" 987|786|"GRT "|"" 3455|896|654|456|"" 457|234|"RT"|"PR TY"|"" Output 123|456|789|"" 987|786|"GRT"|"" 3455|896|654|456|"" 457|234|"RT"|"PRTY"|"" (16 Replies)
Discussion started by: meet_calramz
16 Replies
CP1251(7)						     Linux Programmer's Manual							 CP1251(7)

NAME
cp1251 - the 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.27 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 05:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy