3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $log = "(9143308-9144331):246221357-246222380, (IND):246222381, (9144332-9145355):246222382-246223405, (IND):246223406, (9145356-9146379):246223407-246224430, (IND):246224431, (9146380-9147403):246224432-246225455, (IND):246225456, (9147404-9148427):246225457-246226480, (IND):246226481, (9148428-9149451):246226482-246227505, (IND):246227506, (9149452-9150475):246227507-246228530, (IND):246228531, (9150476-9151499):246228532-246229555, (IND):246229556, (9151500-9152523):246229557-246230580, (IND):246230581, (9152524-9153547):246230582-246231605, (IND):246231606, (9153548-9154571):246231607-246232630, (IND):246232631, (9154572-9155027):246232632-246233087, (9155028-9155595):246233115-246233682, (IND):246233683, (9155596-9156619):246233684-246234707, (IND):246234708, (9156620-9157643):246234709-246235732, (IND):246235733, (9157644-9158667):246235734-246236757, (IND):246236758, (9158668-9159691):246236759-246237782, (IND):246237783, (9159692-9160715):246237784-246238807, (IND):246238808, (9160716-9161739):246238809-246239832, (IND):246239833, (9161740-9162763):246239834-246240857, (IND):246240858, (9162764-9163787):246240859-246241882, (IND):246241883, (9163788-9164811):246241884-246242907, (IND):246242908, (9164812-9165835):246242909-246243932, (IND):246243933, (9165836-9166859):246243934-246244957, (IND):246244958, (9166860-9167883):246244959-246245982, (IND):246245983, (9167884-9168907):246245984-246247007, (IND):246247008, (9168908-9169931):246247009-246248032, (IND):246248033, (9169932-9170955):246248034-246249057, (IND):246249058, (9170956-9171979):246249059-246250082, (IND):246250083, (9171980-9173003):246250084-246251107, (IND):246251108, (9173004-9173414):246251109-246251519, (9173415-9174027):246252034-246252646, (IND):246252647, (9174028-9175039):246252648-246253659 TOTAL: 9184010"; $out = '#!/bin/sh' . PHP_EOL; $matches = array(); if (preg_match_all('/((.*?)-(.*?)):(.*?)-(.*?),/m', $log, $matches)) { var_dump($matches); foreach ($matches as $match) { $blockSize = $match[1][1] - $match[1][0] + 1; $startingBlock = $match[1][3]; $out .= sprintf('fsgrab -c %s -s %s /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla"', $blockSize, $startingBlock) . PHP_EOL; } } echo $out;
based on Re24Q
Output for 7.1.0 - 7.2.0
array(6) { [0]=> array(32) { [0]=> string(38) "(9143308-9144331):246221357-246222380," [1]=> string(56) " (IND):246222381, (9144332-9145355):246222382-246223405," [2]=> string(56) " (IND):246223406, (9145356-9146379):246223407-246224430," [3]=> string(56) " (IND):246224431, (9146380-9147403):246224432-246225455," [4]=> string(56) " (IND):246225456, (9147404-9148427):246225457-246226480," [5]=> string(56) " (IND):246226481, (9148428-9149451):246226482-246227505," [6]=> string(56) " (IND):246227506, (9149452-9150475):246227507-246228530," [7]=> string(56) " (IND):246228531, (9150476-9151499):246228532-246229555," [8]=> string(56) " (IND):246229556, (9151500-9152523):246229557-246230580," [9]=> string(56) " (IND):246230581, (9152524-9153547):246230582-246231605," [10]=> string(56) " (IND):246231606, (9153548-9154571):246231607-246232630," [11]=> string(56) " (IND):246232631, (9154572-9155027):246232632-246233087," [12]=> string(39) " (9155028-9155595):246233115-246233682," [13]=> string(56) " (IND):246233683, (9155596-9156619):246233684-246234707," [14]=> string(56) " (IND):246234708, (9156620-9157643):246234709-246235732," [15]=> string(56) " (IND):246235733, (9157644-9158667):246235734-246236757," [16]=> string(56) " (IND):246236758, (9158668-9159691):246236759-246237782," [17]=> string(56) " (IND):246237783, (9159692-9160715):246237784-246238807," [18]=> string(56) " (IND):246238808, (9160716-9161739):246238809-246239832," [19]=> string(56) " (IND):246239833, (9161740-9162763):246239834-246240857," [20]=> string(56) " (IND):246240858, (9162764-9163787):246240859-246241882," [21]=> string(56) " (IND):246241883, (9163788-9164811):246241884-246242907," [22]=> string(56) " (IND):246242908, (9164812-9165835):246242909-246243932," [23]=> string(56) " (IND):246243933, (9165836-9166859):246243934-246244957," [24]=> string(56) " (IND):246244958, (9166860-9167883):246244959-246245982," [25]=> string(56) " (IND):246245983, (9167884-9168907):246245984-246247007," [26]=> string(56) " (IND):246247008, (9168908-9169931):246247009-246248032," [27]=> string(56) " (IND):246248033, (9169932-9170955):246248034-246249057," [28]=> string(56) " (IND):246249058, (9170956-9171979):246249059-246250082," [29]=> string(56) " (IND):246250083, (9171980-9173003):246250084-246251107," [30]=> string(56) " (IND):246251108, (9173004-9173414):246251109-246251519," [31]=> string(39) " (9173415-9174027):246252034-246252646," } [1]=> array(32) { [0]=> string(17) "(9143308-9144331)" [1]=> string(35) " (IND):246222381, (9144332-9145355)" [2]=> string(35) " (IND):246223406, (9145356-9146379)" [3]=> string(35) " (IND):246224431, (9146380-9147403)" [4]=> string(35) " (IND):246225456, (9147404-9148427)" [5]=> string(35) " (IND):246226481, (9148428-9149451)" [6]=> string(35) " (IND):246227506, (9149452-9150475)" [7]=> string(35) " (IND):246228531, (9150476-9151499)" [8]=> string(35) " (IND):246229556, (9151500-9152523)" [9]=> string(35) " (IND):246230581, (9152524-9153547)" [10]=> string(35) " (IND):246231606, (9153548-9154571)" [11]=> string(35) " (IND):246232631, (9154572-9155027)" [12]=> string(18) " (9155028-9155595)" [13]=> string(35) " (IND):246233683, (9155596-9156619)" [14]=> string(35) " (IND):246234708, (9156620-9157643)" [15]=> string(35) " (IND):246235733, (9157644-9158667)" [16]=> string(35) " (IND):246236758, (9158668-9159691)" [17]=> string(35) " (IND):246237783, (9159692-9160715)" [18]=> string(35) " (IND):246238808, (9160716-9161739)" [19]=> string(35) " (IND):246239833, (9161740-9162763)" [20]=> string(35) " (IND):246240858, (9162764-9163787)" [21]=> string(35) " (IND):246241883, (9163788-9164811)" [22]=> string(35) " (IND):246242908, (9164812-9165835)" [23]=> string(35) " (IND):246243933, (9165836-9166859)" [24]=> string(35) " (IND):246244958, (9166860-9167883)" [25]=> string(35) " (IND):246245983, (9167884-9168907)" [26]=> string(35) " (IND):246247008, (9168908-9169931)" [27]=> string(35) " (IND):246248033, (9169932-9170955)" [28]=> string(35) " (IND):246249058, (9170956-9171979)" [29]=> string(35) " (IND):246250083, (9171980-9173003)" [30]=> string(35) " (IND):246251108, (9173004-9173414)" [31]=> string(18) " (9173415-9174027)" } [2]=> array(32) { [0]=> string(8) "(9143308" [1]=> string(26) " (IND):246222381, (9144332" [2]=> string(26) " (IND):246223406, (9145356" [3]=> string(26) " (IND):246224431, (9146380" [4]=> string(26) " (IND):246225456, (9147404" [5]=> string(26) " (IND):246226481, (9148428" [6]=> string(26) " (IND):246227506, (9149452" [7]=> string(26) " (IND):246228531, (9150476" [8]=> string(26) " (IND):246229556, (9151500" [9]=> string(26) " (IND):246230581, (9152524" [10]=> string(26) " (IND):246231606, (9153548" [11]=> string(26) " (IND):246232631, (9154572" [12]=> string(9) " (9155028" [13]=> string(26) " (IND):246233683, (9155596" [14]=> string(26) " (IND):246234708, (9156620" [15]=> string(26) " (IND):246235733, (9157644" [16]=> string(26) " (IND):246236758, (9158668" [17]=> string(26) " (IND):246237783, (9159692" [18]=> string(26) " (IND):246238808, (9160716" [19]=> string(26) " (IND):246239833, (9161740" [20]=> string(26) " (IND):246240858, (9162764" [21]=> string(26) " (IND):246241883, (9163788" [22]=> string(26) " (IND):246242908, (9164812" [23]=> string(26) " (IND):246243933, (9165836" [24]=> string(26) " (IND):246244958, (9166860" [25]=> string(26) " (IND):246245983, (9167884" [26]=> string(26) " (IND):246247008, (9168908" [27]=> string(26) " (IND):246248033, (9169932" [28]=> string(26) " (IND):246249058, (9170956" [29]=> string(26) " (IND):246250083, (9171980" [30]=> string(26) " (IND):246251108, (9173004" [31]=> string(9) " (9173415" } [3]=> array(32) { [0]=> string(8) "9144331)" [1]=> string(8) "9145355)" [2]=> string(8) "9146379)" [3]=> string(8) "9147403)" [4]=> string(8) "9148427)" [5]=> string(8) "9149451)" [6]=> string(8) "9150475)" [7]=> string(8) "9151499)" [8]=> string(8) "9152523)" [9]=> string(8) "9153547)" [10]=> string(8) "9154571)" [11]=> string(8) "9155027)" [12]=> string(8) "9155595)" [13]=> string(8) "9156619)" [14]=> string(8) "9157643)" [15]=> string(8) "9158667)" [16]=> string(8) "9159691)" [17]=> string(8) "9160715)" [18]=> string(8) "9161739)" [19]=> string(8) "9162763)" [20]=> string(8) "9163787)" [21]=> string(8) "9164811)" [22]=> string(8) "9165835)" [23]=> string(8) "9166859)" [24]=> string(8) "9167883)" [25]=> string(8) "9168907)" [26]=> string(8) "9169931)" [27]=> string(8) "9170955)" [28]=> string(8) "9171979)" [29]=> string(8) "9173003)" [30]=> string(8) "9173414)" [31]=> string(8) "9174027)" } [4]=> array(32) { [0]=> string(9) "246221357" [1]=> string(9) "246222382" [2]=> string(9) "246223407" [3]=> string(9) "246224432" [4]=> string(9) "246225457" [5]=> string(9) "246226482" [6]=> string(9) "246227507" [7]=> string(9) "246228532" [8]=> string(9) "246229557" [9]=> string(9) "246230582" [10]=> string(9) "246231607" [11]=> string(9) "246232632" [12]=> string(9) "246233115" [13]=> string(9) "246233684" [14]=> string(9) "246234709" [15]=> string(9) "246235734" [16]=> string(9) "246236759" [17]=> string(9) "246237784" [18]=> string(9) "246238809" [19]=> string(9) "246239834" [20]=> string(9) "246240859" [21]=> string(9) "246241884" [22]=> string(9) "246242909" [23]=> string(9) "246243934" [24]=> string(9) "246244959" [25]=> string(9) "246245984" [26]=> string(9) "246247009" [27]=> string(9) "246248034" [28]=> string(9) "246249059" [29]=> string(9) "246250084" [30]=> string(9) "246251109" [31]=> string(9) "246252034" } [5]=> array(32) { [0]=> string(9) "246222380" [1]=> string(9) "246223405" [2]=> string(9) "246224430" [3]=> string(9) "246225455" [4]=> string(9) "246226480" [5]=> string(9) "246227505" [6]=> string(9) "246228530" [7]=> string(9) "246229555" [8]=> string(9) "246230580" [9]=> string(9) "246231605" [10]=> string(9) "246232630" [11]=> string(9) "246233087" [12]=> string(9) "246233682" [13]=> string(9) "246234707" [14]=> string(9) "246235732" [15]=> string(9) "246236757" [16]=> string(9) "246237782" [17]=> string(9) "246238807" [18]=> string(9) "246239832" [19]=> string(9) "246240857" [20]=> string(9) "246241882" [21]=> string(9) "246242907" [22]=> string(9) "246243932" [23]=> string(9) "246244957" [24]=> string(9) "246245982" [25]=> string(9) "246247007" [26]=> string(9) "246248032" [27]=> string(9) "246249057" [28]=> string(9) "246250082" [29]=> string(9) "246251107" [30]=> string(9) "246251519" [31]=> string(9) "246252646" } } Warning: A non-numeric value encountered in /in/NW2ko on line 13 Warning: A non-numeric value encountered in /in/NW2ko on line 13 Warning: A non-numeric value encountered in /in/NW2ko on line 13 Warning: A non-numeric value encountered in /in/NW2ko on line 13 Warning: A non-numeric value encountered in /in/NW2ko on line 13 Warning: A non-numeric value encountered in /in/NW2ko on line 13 #!/bin/sh fsgrab -c 1 -s N /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla" fsgrab -c 1 -s N /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla" fsgrab -c 1 -s N /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla" fsgrab -c -7 -s 5 /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla" fsgrab -c 3 -s 2 /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla" fsgrab -c 3 -s 2 /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla"
Output for 5.3.21 - 7.0.20
array(6) { [0]=> array(32) { [0]=> string(38) "(9143308-9144331):246221357-246222380," [1]=> string(56) " (IND):246222381, (9144332-9145355):246222382-246223405," [2]=> string(56) " (IND):246223406, (9145356-9146379):246223407-246224430," [3]=> string(56) " (IND):246224431, (9146380-9147403):246224432-246225455," [4]=> string(56) " (IND):246225456, (9147404-9148427):246225457-246226480," [5]=> string(56) " (IND):246226481, (9148428-9149451):246226482-246227505," [6]=> string(56) " (IND):246227506, (9149452-9150475):246227507-246228530," [7]=> string(56) " (IND):246228531, (9150476-9151499):246228532-246229555," [8]=> string(56) " (IND):246229556, (9151500-9152523):246229557-246230580," [9]=> string(56) " (IND):246230581, (9152524-9153547):246230582-246231605," [10]=> string(56) " (IND):246231606, (9153548-9154571):246231607-246232630," [11]=> string(56) " (IND):246232631, (9154572-9155027):246232632-246233087," [12]=> string(39) " (9155028-9155595):246233115-246233682," [13]=> string(56) " (IND):246233683, (9155596-9156619):246233684-246234707," [14]=> string(56) " (IND):246234708, (9156620-9157643):246234709-246235732," [15]=> string(56) " (IND):246235733, (9157644-9158667):246235734-246236757," [16]=> string(56) " (IND):246236758, (9158668-9159691):246236759-246237782," [17]=> string(56) " (IND):246237783, (9159692-9160715):246237784-246238807," [18]=> string(56) " (IND):246238808, (9160716-9161739):246238809-246239832," [19]=> string(56) " (IND):246239833, (9161740-9162763):246239834-246240857," [20]=> string(56) " (IND):246240858, (9162764-9163787):246240859-246241882," [21]=> string(56) " (IND):246241883, (9163788-9164811):246241884-246242907," [22]=> string(56) " (IND):246242908, (9164812-9165835):246242909-246243932," [23]=> string(56) " (IND):246243933, (9165836-9166859):246243934-246244957," [24]=> string(56) " (IND):246244958, (9166860-9167883):246244959-246245982," [25]=> string(56) " (IND):246245983, (9167884-9168907):246245984-246247007," [26]=> string(56) " (IND):246247008, (9168908-9169931):246247009-246248032," [27]=> string(56) " (IND):246248033, (9169932-9170955):246248034-246249057," [28]=> string(56) " (IND):246249058, (9170956-9171979):246249059-246250082," [29]=> string(56) " (IND):246250083, (9171980-9173003):246250084-246251107," [30]=> string(56) " (IND):246251108, (9173004-9173414):246251109-246251519," [31]=> string(39) " (9173415-9174027):246252034-246252646," } [1]=> array(32) { [0]=> string(17) "(9143308-9144331)" [1]=> string(35) " (IND):246222381, (9144332-9145355)" [2]=> string(35) " (IND):246223406, (9145356-9146379)" [3]=> string(35) " (IND):246224431, (9146380-9147403)" [4]=> string(35) " (IND):246225456, (9147404-9148427)" [5]=> string(35) " (IND):246226481, (9148428-9149451)" [6]=> string(35) " (IND):246227506, (9149452-9150475)" [7]=> string(35) " (IND):246228531, (9150476-9151499)" [8]=> string(35) " (IND):246229556, (9151500-9152523)" [9]=> string(35) " (IND):246230581, (9152524-9153547)" [10]=> string(35) " (IND):246231606, (9153548-9154571)" [11]=> string(35) " (IND):246232631, (9154572-9155027)" [12]=> string(18) " (9155028-9155595)" [13]=> string(35) " (IND):246233683, (9155596-9156619)" [14]=> string(35) " (IND):246234708, (9156620-9157643)" [15]=> string(35) " (IND):246235733, (9157644-9158667)" [16]=> string(35) " (IND):246236758, (9158668-9159691)" [17]=> string(35) " (IND):246237783, (9159692-9160715)" [18]=> string(35) " (IND):246238808, (9160716-9161739)" [19]=> string(35) " (IND):246239833, (9161740-9162763)" [20]=> string(35) " (IND):246240858, (9162764-9163787)" [21]=> string(35) " (IND):246241883, (9163788-9164811)" [22]=> string(35) " (IND):246242908, (9164812-9165835)" [23]=> string(35) " (IND):246243933, (9165836-9166859)" [24]=> string(35) " (IND):246244958, (9166860-9167883)" [25]=> string(35) " (IND):246245983, (9167884-9168907)" [26]=> string(35) " (IND):246247008, (9168908-9169931)" [27]=> string(35) " (IND):246248033, (9169932-9170955)" [28]=> string(35) " (IND):246249058, (9170956-9171979)" [29]=> string(35) " (IND):246250083, (9171980-9173003)" [30]=> string(35) " (IND):246251108, (9173004-9173414)" [31]=> string(18) " (9173415-9174027)" } [2]=> array(32) { [0]=> string(8) "(9143308" [1]=> string(26) " (IND):246222381, (9144332" [2]=> string(26) " (IND):246223406, (9145356" [3]=> string(26) " (IND):246224431, (9146380" [4]=> string(26) " (IND):246225456, (9147404" [5]=> string(26) " (IND):246226481, (9148428" [6]=> string(26) " (IND):246227506, (9149452" [7]=> string(26) " (IND):246228531, (9150476" [8]=> string(26) " (IND):246229556, (9151500" [9]=> string(26) " (IND):246230581, (9152524" [10]=> string(26) " (IND):246231606, (9153548" [11]=> string(26) " (IND):246232631, (9154572" [12]=> string(9) " (9155028" [13]=> string(26) " (IND):246233683, (9155596" [14]=> string(26) " (IND):246234708, (9156620" [15]=> string(26) " (IND):246235733, (9157644" [16]=> string(26) " (IND):246236758, (9158668" [17]=> string(26) " (IND):246237783, (9159692" [18]=> string(26) " (IND):246238808, (9160716" [19]=> string(26) " (IND):246239833, (9161740" [20]=> string(26) " (IND):246240858, (9162764" [21]=> string(26) " (IND):246241883, (9163788" [22]=> string(26) " (IND):246242908, (9164812" [23]=> string(26) " (IND):246243933, (9165836" [24]=> string(26) " (IND):246244958, (9166860" [25]=> string(26) " (IND):246245983, (9167884" [26]=> string(26) " (IND):246247008, (9168908" [27]=> string(26) " (IND):246248033, (9169932" [28]=> string(26) " (IND):246249058, (9170956" [29]=> string(26) " (IND):246250083, (9171980" [30]=> string(26) " (IND):246251108, (9173004" [31]=> string(9) " (9173415" } [3]=> array(32) { [0]=> string(8) "9144331)" [1]=> string(8) "9145355)" [2]=> string(8) "9146379)" [3]=> string(8) "9147403)" [4]=> string(8) "9148427)" [5]=> string(8) "9149451)" [6]=> string(8) "9150475)" [7]=> string(8) "9151499)" [8]=> string(8) "9152523)" [9]=> string(8) "9153547)" [10]=> string(8) "9154571)" [11]=> string(8) "9155027)" [12]=> string(8) "9155595)" [13]=> string(8) "9156619)" [14]=> string(8) "9157643)" [15]=> string(8) "9158667)" [16]=> string(8) "9159691)" [17]=> string(8) "9160715)" [18]=> string(8) "9161739)" [19]=> string(8) "9162763)" [20]=> string(8) "9163787)" [21]=> string(8) "9164811)" [22]=> string(8) "9165835)" [23]=> string(8) "9166859)" [24]=> string(8) "9167883)" [25]=> string(8) "9168907)" [26]=> string(8) "9169931)" [27]=> string(8) "9170955)" [28]=> string(8) "9171979)" [29]=> string(8) "9173003)" [30]=> string(8) "9173414)" [31]=> string(8) "9174027)" } [4]=> array(32) { [0]=> string(9) "246221357" [1]=> string(9) "246222382" [2]=> string(9) "246223407" [3]=> string(9) "246224432" [4]=> string(9) "246225457" [5]=> string(9) "246226482" [6]=> string(9) "246227507" [7]=> string(9) "246228532" [8]=> string(9) "246229557" [9]=> string(9) "246230582" [10]=> string(9) "246231607" [11]=> string(9) "246232632" [12]=> string(9) "246233115" [13]=> string(9) "246233684" [14]=> string(9) "246234709" [15]=> string(9) "246235734" [16]=> string(9) "246236759" [17]=> string(9) "246237784" [18]=> string(9) "246238809" [19]=> string(9) "246239834" [20]=> string(9) "246240859" [21]=> string(9) "246241884" [22]=> string(9) "246242909" [23]=> string(9) "246243934" [24]=> string(9) "246244959" [25]=> string(9) "246245984" [26]=> string(9) "246247009" [27]=> string(9) "246248034" [28]=> string(9) "246249059" [29]=> string(9) "246250084" [30]=> string(9) "246251109" [31]=> string(9) "246252034" } [5]=> array(32) { [0]=> string(9) "246222380" [1]=> string(9) "246223405" [2]=> string(9) "246224430" [3]=> string(9) "246225455" [4]=> string(9) "246226480" [5]=> string(9) "246227505" [6]=> string(9) "246228530" [7]=> string(9) "246229555" [8]=> string(9) "246230580" [9]=> string(9) "246231605" [10]=> string(9) "246232630" [11]=> string(9) "246233087" [12]=> string(9) "246233682" [13]=> string(9) "246234707" [14]=> string(9) "246235732" [15]=> string(9) "246236757" [16]=> string(9) "246237782" [17]=> string(9) "246238807" [18]=> string(9) "246239832" [19]=> string(9) "246240857" [20]=> string(9) "246241882" [21]=> string(9) "246242907" [22]=> string(9) "246243932" [23]=> string(9) "246244957" [24]=> string(9) "246245982" [25]=> string(9) "246247007" [26]=> string(9) "246248032" [27]=> string(9) "246249057" [28]=> string(9) "246250082" [29]=> string(9) "246251107" [30]=> string(9) "246251519" [31]=> string(9) "246252646" } } #!/bin/sh fsgrab -c 1 -s N /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla" fsgrab -c 1 -s N /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla" fsgrab -c 1 -s N /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla" fsgrab -c -7 -s 5 /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla" fsgrab -c 3 -s 2 /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla" fsgrab -c 3 -s 2 /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla"