regex - extract strings at specifc positions -


i have huge fixed-width string looks below:

b100000da3f19c                                     android                                                                                              600             ,                                                2011-08-29 15:03:21.537 352a0d21ffd800000a3a95911801700e                   ipad                                                                                                 600             ios                                                2011-08-29 19:35:12.753 . . . 

i need extract first part (id) , fourth part (device type - "and" or "ios"). first column starts @ 0 , ends @ 51st position lines. fourth part starts @ 168 , ends @ 171 lines. length of each line 244 characters. if complicated, other option delete in file except id , device type. single file has around 800k records measuring 180mb notepad++ seems handling okay.

i tried doing sql server import data though preview looks fine, when data gets inserted table, not accurate.

i have following far gives me first 51 characters -

^(.{51}).* 

it great if 1 regex keep id , device type , delete rest.

well if @ position simple way this:

^(.{51}).{117}(.{3}) 

the parentheses captures (the results getting out), while brackets counters.

edit: use following explicitly discard rest of line:

^(.{51}).{117}(.{3}).*$ 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -