Lists unambigously names of all xml elements used in files in current directory

grep -Eho '<[a-ZA-Z_][a-zA-Z0-9_-:]*' * | sort -u | cut -c2-
This one will work a little better, the regular expressions it is not 100% accurate for XML parsing but it will suffice any XML valid document for sure.
Sample Output
a
b
body
br
center
div
fieldset
font
form
func:function
func:result
h1
h2
h4
head
html
i
img
input
label
li
link
meta
noscript
option
p
sc
script
select
span
strong
style
table
tbody
td
textarea
th
title
tr
ul
xsl:apply-templates
xsl:attribute
xsl:call-template
xsl:choose
xsl:copy-of
xsl:for-each
xsl:if
xsl:include
xsl:otherwise
xsl:param
xsl:stylesheet
xsl:template
xsl:text
xsl:value-of
xsl:variable
xsl:when
xsl:with-param

0
By: inkel
2009-08-05 21:54:29

1 Alternatives + Submit Alt

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: