sam.987 |
06-25-2017 06:33 PM |
remove line spaces and add new line entry for array
Hi.
Is there a way to remove line break and extra spaces using awk or sed?
My input file is
Code:
[array([ 0.02845476, 0.02685638, 0.01360762, 0.01018389, 0.00817233,
0.00769514, 0.00766023, 0.00871935, 0.00992978, 0.01282394,
0.01833876, 0.03112197, 0.04668878, 0.03155843, 0.01698091,
0.01226917, 0.00854671, 0.00798805, 0.00596485, 0.00646532,
0.00658752, 0.00882022, 0.01276575, 0.03148277, 0.03787438,
0.58244297]),
array([ 0.035 , 0.03807317, 0.01169512, 0.00759146, 0.00479878,
0.00514634, 0.0037378 , 0.00606707, 0.00528049, 0.00892683,
0.00631707, 0.01397561, 0.01756098, 0.0159939 , 0.00477439,
0.00714024, 0.00343293, 0.00530488, 0.00282927, 0.00380488,
0.00390854, 0.00551829, 0.00696951, 0.03689634, 0.0427439 ,
0.6965122 ]),
array([ 0.04180773, 0.037372 , 0.01278474, 0.0072884 , 0.00573145,
0.00536573, 0.0049791 , 0.00514629, 0.0049373 , 0.00582027,
0.00749216, 0.00933124, 0.01535005, 0.01035528, 0.00504702,
0.00487983, 0.00304598, 0.00344828, 0.00279519, 0.00337513,
0.00361024, 0.00460293, 0.00856844, 0.0260815 , 0.10672414,
0.65405956]),
array([ 0.03015278, 0.02738889, 0.0125 , 0.00875 , 0.00736806,
0.00672917, 0.00763889, 0.01044444, 0.01178472, 0.01470139,
0.02020833, 0.03288194, 0.05940278, 0.03489583, 0.01829167,
0.01255556, 0.00811111, 0.00670139, 0.00543056, 0.00570139,
0.00616667, 0.00821528, 0.01138889, 0.02573611, 0.03044444,
0.57640972]),
And my expected output is:
Quote:
array([ 0.02845476, 0.02685638, 0.01360762, 0.01018389, 0.00817233, 0.00769514, 0.00766023, 0.00871935, 0.00992978, 0.01282394,0.01833876, 0.03112197, 0.04668878, 0.03155843, 0.01698091, 0.01226917, 0.00854671, 0.00798805, 0.00596485, 0.00646532, 0.00658752, 0.00882022, 0.01276575, 0.03148277, 0.03787438, 0.58244297]),
array([ 0.035 , 0.03807317, 0.01169512, 0.00759146, 0.00479878, 0.00514634, 0.0037378 , 0.00606707, 0.00528049, 0.00892683, 0.00631707, 0.01397561, 0.01756098, 0.0159939 , 0.00477439, 0.00714024, 0.00343293, 0.00530488, 0.00282927, 0.00380488, 0.00390854, 0.00551829, 0.00696951, 0.03689634, 0.0427439 , 0.6965122]),
array([ 0.04180773, 0.037372 , 0.01278474, 0.0072884 , 0.00573145,0.00536573, 0.0049791 , 0.00514629, 0.0049373 , 0.00582027, 0.00749216, 0.00933124, 0.01535005, 0.01035528, 0.00504702, 0.00487983, 0.00304598, 0.00344828, 0.00279519, 0.00337513, 0.00361024, 0.00460293, 0.00856844, 0.0260815 , 0.10672414, 0.65405956]),
array([ 0.03015278, 0.02738889, 0.0125 , 0.00875 , 0.00736806, 0.00672917, 0.00763889, 0.01044444, 0.01178472, 0.01470139, 0.02020833, 0.03288194, 0.05940278, 0.03489583, 0.01829167, 0.01255556, 0.00811111, 0.00670139, 0.00543056, 0.00570139, 0.00616667, 0.00821528, 0.01138889, 0.02573611, 0.03044444, 0.57640972]),
|
Aiming to remove line spaces and start a new line for every appearance of string "array"
|