# removing html tags via parameter expansion

**URL:** <https://community.unix.com/t/removing-html-tags-via-parameter-expansion/189042>\
**Category:** Shell Programming and Scripting\
**Created:** [March 14, 2008, 11:06am UTC](https://community.unix.com/t/removing-html-tags-via-parameter-expansion/189042 "2008-03-14T11:06:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rev66](https://community.unix.com/letter_avatar/rev66/32/5_5575768a8748004e209b776fc1b2916d.png) [@rev66](https://community.unix.com/u/rev66)\
**Post date:** [March 14, 2008, 11:06am UTC](https://community.unix.com/t/removing-html-tags-via-parameter-expansion/189042/1 "2008-03-14T11:06:32Z")

</div>

Hi all-

I have a variable that contains a web page:

echo $STUFF

\<html\> \<head\> \<title\>my page\</title\>\</head\> \<body\> blah blah etc..

Can I use the shell's parameter expansion abilities to remove just the tags?  
I thought that FIXHTML=${STUFF//\<\*\>/} might do it, but it didn't seem to work.

Do I need to escape the \< and \> or something like that?

Thanks!!

-Rev66

---

<div class="post-metadata">

**Author:** ![Tytalus](https://community.unix.com/user_avatar/community.unix.com/tytalus/32/87_2.png) [@Tytalus](https://community.unix.com/u/Tytalus)\
**Post date:** [March 14, 2008, 11:41am UTC](https://community.unix.com/t/removing-html-tags-via-parameter-expansion/189042/2 "2008-03-14T11:41:13Z")

</div>

depending on exact content, this should mostly work:

```nohighlight
# echo $STUFF | sed 's/<[^>]*>//g'
  my page blah blah

```

---

<div class="post-metadata">

**Author:** ![rev66](https://community.unix.com/letter_avatar/rev66/32/5_5575768a8748004e209b776fc1b2916d.png) [@rev66](https://community.unix.com/u/rev66)\
**Post date:** [March 14, 2008, 12:26pm UTC](https://community.unix.com/t/removing-html-tags-via-parameter-expansion/189042/3 "2008-03-14T12:26:44Z")

</div>

> [@tytalus](#):
>
> depending on exact content, this should mostly work:
> 
> ```plaintext
> # echo $STUFF | sed 's/<[^>]*>//g'
> my page blah blah
> 
> ```

I had considered doing that exact thing, but I'd really like to avoid the additional process if possible by doing it in the shell...
