- シェルスクリプト総合 その30
470 :デフォルトの名無しさん[sage]:2019/08/02(金) 20:38:11.21 ID:cEuue6ob - なら5行目を取り出せばいいじゃん
|
- シェルスクリプト総合 その30
478 :デフォルトの名無しさん[sage]:2019/08/02(金) 21:38:37.66 ID:cEuue6ob - 正直、CLIツール使って一発でやってしまおう!
なんて考えるから難しくなるんだよ。 一行一データになってないものは、 シェルスクリプトでやったほうが楽 #!/bin/sh a=$(cat html.txt) a=${a#*<td>} a=${a#*<td>} a=${a%%</td>*} echo "$a"
|
- シェルスクリプト総合 その30
485 :デフォルトの名無しさん[sage]:2019/08/02(金) 23:34:34.72 ID:cEuue6ob - Ruby遅すぎるんだよ
$ time ruby html.rb "AAAA" "BBBB" real 0m0.079s user 0m0.079s sys 0m0.000s $ time sh html.sh BBBB real 0m0.002s user 0m0.002s sys 0m0.000s
|
- シェルスクリプト総合 その30
486 :デフォルトの名無しさん[sage]:2019/08/02(金) 23:36:49.26 ID:cEuue6ob - これも遅いな。やっぱりシェルスクリプトが一番か
$ time grep -Pzo '<td>\n?\K(.|\n)*?(?=\n?</td>)' x.xml | tr '\0' '\n' | sed -n 2p BBBB real 0m0.003s user 0m0.004s sys 0m0.003s
|
- シェルスクリプト総合 その30
487 :デフォルトの名無しさん[sage]:2019/08/02(金) 23:38:32.60 ID:cEuue6ob - こうしたらさらに速くなったわw
シェルスクリプト最強伝説 #!/bin/sh a=" <td> AAAA </td> <td> BBBB </td> " a=${a#*<td>} a=${a#*<td>} a=${a%%</td>*} echo "$a" $ time sh html.sh BBBB real 0m0.001s user 0m0.001s sys 0m0.000s
|