regex - How to find and replace in a text editor? -


i new text editing, i'm sorry if question unclear, let me know if there's can specify make question more understandable.

my file has 27 tab-separated columns , thousands of rows. want replace tabs underscore (basically merging first 3 columns together), after first 2 columns. how do this?

here's have find:

([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([ ^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^ \t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)\r

and here's replace:

\1_\2_\3\t\4\t\5\t\6\t\7\t\8\t\9\t\10\t\11\t\12\t\13\t\14\t\15\t\16\t\17\t\18\t\19\t\20\t\21\t\22\t\23\t\24\t\25\t\26\t\27\r

also, references regex guide welcomed!

below representative data. each number separated tab in editor, not space.

chr1 28404 29751 25 14 57 42 44 44 56 34 16 24 18 24 24 23 24 163 57 30 28 31 36 23 28 17

chr1 235561 236222 5 13 4 24 4 8 7 6 5 14 20 7 10 3 6 11 9 9 16 8 16 6 11 9

chr1 540455 541272 20 11 6 7 5 7 12 24 7 9 9 6 22 3 10 32 18 22 11 13 10 27 9 10

chr1 713112 715467 96 105 332 159 131 277 225 199 61 164 128 116 156 107 143 687 204 186 97 125 174 193 213 118

chr1 761657 764380 106 153 334 182 161 326 215 343 85 174 160 135 176 151 141 724 308 223 120 141 200 198 247 151

try find :

(.+?)\t(.+?)\t(.+?)\n 

replace

\1_\2_\3\n 

have @ demo

moreover you'll have disable ". matches new line" in text editor.


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 -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -