1

次の出力を取得します。

<iframe  src="http://domain.xy/load.php?file=2260301" frameborder="0" scrolling="no"></iframe>|http://img1.domain.xy/t/301/320/5_2260301.jpg;http://img1.domain.xy/t/301/320/1_2260301.jpg;http://img1.domain.xy/t/301/320/2_2260301.jpg;http://img1.domain.xy/t/301/320/3_2260301.jpg;http://img1.domain.xy/t/301/320/4_2260301.jpg;http://img1.domain.xy/t/301/320/6_2260301.jpg;http://img1.domain.xy/t/301/320/7_2260301.jpg;http://img1.domain.xy/t/301/320/8_2260301.jpg;http://img1.domain.xy/t/301/320/9_2260301.jpg;http://img1.domain.xy/t/301/320/10_2260301.jpg|
<iframe  src="http://domain.xy/load.php?file=2260279" frameborder="0" scrolling="no"></iframe>|http://img9.domain.xy/t/279/320/10_2260279.jpg;http://img9.domain.xy/t/279/320/1_2260279.jpg;http://img9.domain.xy/t/279/320/2_2260279.jpg;http://img9.domain.xy/t/279/320/3_2260279.jpg;http://img9.domain.xy/t/279/320/4_2260279.jpg;http://img9.domain.xy/t/279/320/5_2260279.jpg;http://img9.domain.xy/t/279/320/6_2260279.jpg;http://img9.domain.xy/t/279/320/7_2260279.jpg;http://img9.domain.xy/t/279/320/8_2260279.jpg;http://img9.domain.xy/t/279/320/9_2260279.jpg|
<iframe  src="http://domain.xy/load.php?file=2259929" frameborder="0" scrolling="no"></iframe>|http://img9.domain.xy/t/929/320/1_2259929.jpg;http://img9.domain.xy/t/929/320/2_2259929.jpg;http://img9.domain.xy/t/929/320/3_2259929.jpg;http://img9.domain.xy/t/929/320/4_2259929.jpg;http://img9.domain.xy/t/929/320/5_2259929.jpg;http://img9.domain.xy/t/929/320/6_2259929.jpg;http://img9.domain.xy/t/929/320/7_2259929.jpg;http://img9.domain.xy/t/929/320/8_2259929.jpg;http://img9.domain.xy/t/929/320/9_2259929.jpg;http://img9.domain.xy/t/929/320/10_2259929.jpg|

そして以下が必要です:

<iframe  src="http://domain.xy/load.php?file=2260301" frameborder="0" scrolling="no"></iframe>|5_2260301.jpg;1_2260301.jpg;2_2260301.jpg;3_2260301.jpg;4_2260301.jpg;6_2260301.jpg;7_2260301.jpg;8_2260301.jpg;9_2260301.jpg;10_2260301.jpg|http://img1.domain.xy/t/301/320/|
<iframe  src="http://domain.xy/load.php?file=2260279" frameborder="0" scrolling="no"></iframe>|10_2260279.jpg;1_2260279.jpg;2_2260279.jpg;3_2260279.jpg;4_2260279.jpg;5_2260279.jpg;6_2260279.jpg;7_2260279.jpg;8_2260279.jpg;9_2260279.jpg|http://img9.domain.xy/t/279/320/|
<iframe  src="http://domain.xy/load.php?file=2259929" frameborder="0" scrolling="no"></iframe>|1_2259929.jpg;2_2259929.jpg;3_2259929.jpg;4_2259929.jpg;5_2259929.jpg;6_2259929.jpg;7_2259929.jpg;8_2259929.jpg;9_2259929.jpg;10_2259929.jpg|http://img9.domain.xy/t/929/320/

このコマンドを使用してjpgファイル名のみを取得し、

sed 's|http://img*......................||g'

これはエレガントではありません。別の解決策を探します。ディレクトリのURLを保存し、それぞれを行末に置く方法を知る必要がありますhttp://img9.domain.xy/t/929/320/

助けてthx

4

2 に答える 2

0

" http://img1.domain.xy/t/301/320/5_2260301.jpg "のような URL の最後の部分が必要な場合は、次の正規表現を使用できます。/([0-9_]+\.[a-z]{3,4}+)

すべての番号とすべての拡張子 (.jpeg、.png、...) で動作します。

于 2013-10-02T19:11:54.160 に答える