====== 12 Sed 最短一致 ====== 正規表現デフォルト最長一致なので、最短一致の場合は [^ ] かっこ内の任意の1文字に不一致を利用する。 $ echo "AAA-BBB-CCC" | sed 's/^\([^-]*\).*/\1/g' AAA {{tag>bash sed}}