Born Too Late

Yuya's old tech blog.

HTML ファイル中に含まれるタグを抽出するワンライナー

2010-03-23 09:43:14
$ ruby -ne 'puts $_.downcase.scan(%r|<([a-z0-9]+)[^>]*>|i)' ./index.html | sort | uniq
a
body
br
dd
div
dl
dt
h1
h2
h3
h4
head
html
img
input
li
link
meta
p
script
title
ul

ね、簡単でしょ?