Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
与えられたファイル:
aaabbcc.43.311b.file ddeeff.x51.311b.file ffg.1.311b.file hh.ii.jj.x26.311b.file ll.m.311.311b.file
311b ではなく、ファイル名内の数字を取得するにはどうすればよいですか? したがって、43、51、1、26、および 311 を取得したいと思います。
sed 's#[^0-9]\+\([0-9]\+\).*#\1#' INPUTFILE
例の行に必要な出力が得られます。入力行で最初の数字グループを検索し、それらのみを出力します。