Skip to content

Instantly share code, notes, and snippets.

@yuryofujita
Last active June 12, 2019 04:44
Show Gist options
  • Save yuryofujita/6b40a0bda674fca8814eddb9fbc16c07 to your computer and use it in GitHub Desktop.
Save yuryofujita/6b40a0bda674fca8814eddb9fbc16c07 to your computer and use it in GitHub Desktop.
php grepでファイルの文字列取得
<?php
echo "aaa";
echo PHP_EOL;
$cmd = 'find . -type f -name "*.txt" | xargs fgrep "Aki_Komo"';
$grep = exec($cmd);
$grep = preg_replace('/[^0-9]/', '', $grep);
echo $grep;
echo PHP_EOL;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment