1
egrepを使用してファイルから複数の文字列を検索したいが、変数を使用して検索文字列の値を格納したい。これは、プログラムで検索文字列を変更するのに役立ちます。例: -egrepでvaribleを検索文字列として使用する方法
SEARCHSTRING='typesetting industry|printer took|specimen'
cat /tmp/input.file|egrep $SEARCHSTRING > /tmp/output.file
input.file内容:
*Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book. It has survived not only five centuries,
but also the leap into electronic*
output.file内容(予定):
*Lorem Ipsum is simply dummy text of the printing and typesetting industry.
1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book. It has survived not only five centuries,*