4

Is there a way to do this in Ubuntu? I've read it's possible in php, but I'm not familiar with php at all.

belacqua
  • 23,120
22lk94k943 only
  • 1,113
  • 4
  • 16
  • 25

2 Answers2

3

You could use sed for that, but it will only work for links that are in a single line in the html code.

Update:

Damn greedy regex! ;) This one should work now!

sed -i 's|<a[^>]\+>|<a>|g' <the-html-file>

ortang
  • 2,143
  • 14
  • 13
1

Depends what you are trying to do:

If you have a pile of files on your machine, and you want to remove the links, use something like a wee perl script to remove the <a ...> ... </a> tags. You can remove other tags (or even all tags) in a similar way. With the right pattern matching options, this approach can handle tags split across multiple lines. (It's very elegant, but the details won't fit in the margin of this post).

If you are trying to browse files on some webserver, using firefox (or other browser), some kind of greasemonkey script that automatically modifies pages on the fly, before showing them, might be what you want.

Corey Goldberg
  • 3,046
  • 3
  • 19
  • 21