Strip html tags using php as bash one-liner

Alec Jacobson

September 15, 2011

weblog/

The following takes input from standard in and strips all html tags
php -R 'echo strip_tags($argn)."\n";'
So this example
echo "<cage who knows why='angelou'>bird</cage>" | php -R 'echo strip_tags($argn)."\n";'
produces
bird
Source: This actually comes straight from the man page for php.