Say you have a file and want to pull a line out of the middle, for example line 4 from functions.php:
- sed -n 4p functions.php
function uuid() {
If you want to pull a range, say lines 4 through 10:
- sed -n 4,10p functions.php
function uuid() {
return sprintf( ‘%04x%04x-%04x-%04x-%04x-%04x%04x%04x’,
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
mt_rand( 0, 0x0fff ) | 0×4000,
mt_rand( 0, 0x3fff ) | 0×8000,
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) );
}
