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.
ファイルからアドレスを抽出しようとしています。
grep keyword /path/to/file
必要なコード行を見つける方法です。出力は次のようなものです
var=http://address
私が探しているキーワードがとの両方にあることを考えると、ie=の直後の部分だけを取得する方法はありますか?http://addressvarhttp://address
=
http://address
var
grep keyword /path/to/file | cut -d= -f2-
にパイプするだけcutです:
cut
grep keyword /path/to/file | cut -d '=' -f 2
あなたは不必要なパイプを避けることができます:
awk -F= '/keyword/{print $2}' /path/to/file