Sponsored Content
Full Discussion: SED - Create mailto: link
Top Forums Shell Programming and Scripting SED - Create mailto: link Post 302539038 by Nigel_R on Friday 15th of July 2011 03:38:56 AM
Old 07-15-2011
SED - Create mailto: link

Help!
I am using sed to convert text files into easily viewed html tables.
I have managed all except converting the email addresses to mailto: links.
Multiple email addresses exist within the files, either preceded by a space or > (as part of HTML tag), and followed by either space or <
I've tried various things based around the below, but nothing seems to work.
sed -e "s|\w+@\w+\.\w+(\.\w+)?|<a href=\"mailto:\0\">\0</a>|g" nolinks.html > links.html

I am using super-sed 3.62 on an XP machine. (Sorry!!)

Can anyone please help?
Thanks
Nigel
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Create Symbolic Link

I am Solaris korn shell. I want to create a symbolic link. I have a directory /u01/ftp01/db I want to reference it as /u05/swe/my (this is not a real directory) I tried a symbolic link but it does not work ln -s /u01/ftp01/db /u05/swe/my ln: cannot create //u05/swe/my: No such... (2 Replies)
Discussion started by: lesstjm
2 Replies

2. Shell Programming and Scripting

how to create symbolic link between folders.....

hi champs, i have folders structure up to log is there , which is as below, app | |---version-4.1 | |----bin | | | | | |-----a.sh | | |-----b.sh | | | |----log | | \---version (symbolic link to version-4.1) but i want to create another folder... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

3. Shell Programming and Scripting

Shell script to create a link

Hi All, I have a problem to writing a shell script to create a soft link in some other directory For eg: /opt/Shreedhar/Naik is directory now i need to write shell script in the path /opt/Shreedhar/Naik which should create a soft link in /opt/Shreedhar. I have tried to write the script... (3 Replies)
Discussion started by: Shreedhar Naik
3 Replies

4. AIX

How to create a sym link pointing a changing name.

Hello A new file is created every day with the date appended to the end of a name. We are using Autosys to run jobs which watches for the file and runs jobs. But Autosys does not have the capability to figure out the current date. I tried creating a symlink like this ln -s... (1 Reply)
Discussion started by: vra5107
1 Replies

5. Solaris

Create sym-link into /dev (zone)

Hi i need to install a software into a zone, and this kind of software needs to have a file who is linked into /dev. But it is not possible to create a link into /dev nor create a file into it. -bash-3.00# ln -s /tmp/testfile /dev/ ln: cannot create /dev//testfile: Permission denied... (2 Replies)
Discussion started by: beta17
2 Replies

6. Solaris

Not able to create a link in /etc/rc3.d in Solaris 10

HI I am using solaris 10.We are doing some failover testing and checking whether services are starting up when we reboot the server. As part of process i have moved scripts to /etc/init.d directory and trying to create a link /etc/rc3.d like this. But strangely it is giving an error... (5 Replies)
Discussion started by: muraliinfy04
5 Replies

7. Solaris

Create a Link for a directory

Hi, I need to create a link as stagein01 for the /p11/prod/stagein01/. Please let me know the procedure for the same. Regards, VN (5 Replies)
Discussion started by: narayanv
5 Replies

8. UNIX for Advanced & Expert Users

Cannot create a link with the same name

Hi - Our system admin cannot create a link to NAS with one particular name but he can create with other names. What might be the cause? Regards ---------- Post updated at 11:30 AM ---------- Previous update was at 11:29 AM ---------- It says permission denied. (2 Replies)
Discussion started by: w020637
2 Replies

9. Shell Programming and Scripting

awk to create variables to pass into a bash loop to create a download link

I have created one file that contains all the necessary info in it to create a download link. In each of the lines /results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67... (8 Replies)
Discussion started by: cmccabe
8 Replies

10. Web Development

How to create a link that will display the contents of a PHP variable?

Greetings, I've wrote a script that when you point your browser to a machine it displays info about itself. Below is a small snippet of the script: <?php $iloipaddr = `ipmitool lan print | grep 'IP Address ' | cut -d\: -f2 | sed 's/ //'`; $sftwrlist = `rpm -qa | sort`; ?> <p><a... (9 Replies)
Discussion started by: crimso
9 Replies
HTML::FromText(3pm)					User Contributed Perl Documentation				       HTML::FromText(3pm)

NAME
HTML::FromText - Convert plain text to HTML. SYNOPSIS
use HTML::FromText; text2html( $text, %options ); # or use HTML::FromText (); my $t2h = HTML::FromText->new( \%options ); my $html = $t2h->parse( $html ); DESCRIPTION
"HTML::FromText" converts plain text to HTML. There are a handfull of options that shape the conversion. There is a utility function, "text2html", that's exported by default. This function is simply a short- cut to the Object Oriented interface described in detail below. Methods The following methods may be used as the public interface. new my $t2h = HTML::FromText->new({ paras => 1, blockcode => 1, tables => 1, bullets => 1, numbers => 1, urls => 1, email => 1, bold => 1, underline => 1, }); Constructs a new "HTML::FromText" object using the given configuration. The resulting object can parse lots of objects using the "parse" method. Options to "new" are passed by name, with the value being either true or false. If true, the option will be turned on. If false, it will be turned off. The following outlines all the options. Decorators metachars This option is on by default. All characters that are unsafe for HTML display will be encoded using "HTML::Entities::encode_entities()". urls This option is off by default. Replaces URLs with links. email This option is off by default. Replaces email addresses with "mailto:" links. bold This option is off by default. Replaces text surrounded by asterisks ("*") with the same text surrounded by "strong" tags. underline This option is off by default. Replaces text surrownded by underscores ("_") with the same text surrounded by "span" tags with an underline style. Output Modes The following are three output modes and the options associated with them. They are listed in order of precidence. If none of these modes are supplied, the basic decorators are applied to the text in whole. pre This option is off by default. Wraps the entire text in "pre" tags. lines This option is off by default. Preserves line breaks by inserting "br" tags at the end of each line. This mode has further options. spaces This option is off by default. All spaces are HTML encoded. paras This option is off by default. Preserves paragraphs by wrapping them in "p" tags. This mode has further options. bullets This option is off by default. Convert bulleted lists into unordered lists ("ul"). Bullets can be either an asterisk ("*") or a hyphen ("-"). Lists can be nested. numbers This option is off by default. Convert numbered lists into ordered lists ("ol"). Numbered lists are identified by numerals. Lists may be nested. headings This option is off by default. Convert paragraphs identified as headings into HTML headings at the appropriate level. The heading "1. Top" would be heading level one ("h1"). The heading "2.5.1. Blah" would be heading level three ("h3"). title This option is off by default. Convert the first paragraph to a heading level one ("h1"). tables This option is off by default. Convert paragraphs identified as tables to HTML tables. Tables are two or more rows and two or more columns. Columns should be separated by two or more spaces. The following options apply specifically to indented paragraphs. They are listed in order of precidence. blockparas This option is off by default. Convert indented paragraphs to block quotes using the "blockquote" tag. blockquotes Convert indented paragraphs as "blockparas" would, but also preserving line breaks. blockcode Convert indented paragraphs as "blockquotes" would, but also preserving spaces using "pre" tags. parse my $html = $t2h->parse( $text ); Parses text supplied as a single scalar string and returns the HTML as a single scalar string. All the tabs in your text will be expanded using "Text::Tabs::expand()". Functions text2html my $html = text2html( $text, urls => 1, email => 1, ); Functional interface that just wraps the OO interface. This function is exported by default. If you don't want it you can "require" the module or "use" it with an empty list. require HTML::FromText; # or ... use HTML::FromText (); Subclassing Note: At the time of this release, the internals of "HTML::FromText" are in a state of development and cannot be expected to stay the same from release to release. I expect that release version 3.00 will be analogous to a 1.00 release of other software. This is because the cur- rent maintainer has rewritten this distribution from the ground up for the "2.x" series. You have been warned. The following methods may be used for subclassing "HTML::FromText" to create your own text to HTML conversions. Each of these methods is passed just one argument, the object ($self), unless otherwise stated. The structure of $self is as follows for this release. { options => { option_name => $value, ... }, text => $text, # as passed to parse(), with tabs expanded html => $html, # the HTML that will be returned from parse() } pre Used when "pre" mode is specified. Should set "$self->{html}". Return value is ignored. lines Used when "lines" mode is specified. Implements the "spaces" option internally when the option is set to a true value. Should set "$self->{html}". Return value is ignored. paras Used when the "paras" mode is specified. Splits "$self->{text}" into paragraphs internally and sets up "$self->{paras}" as follows. paras => { 0 => { text => $text, # paragraph text html => $html, # paragraph html }, ... # and so on for all paragraphs }, Implements the "title" option internally when the option is turned on. Converts any normal paragraphs to HTML paragraphs (surrounded by "p" tags) internally. Should set "$self->{html}". Return value is ignored. headings Used to format headings when the "headings" option is turned on. Return value is ignored. bullets Format bulleted lists when the "bullets" option is turned on. Return value is ignored. numbers Format numbered lists when the "numbers" option is turned on. Return value is ignored. tables Format tables when the "tables" option is turned on. Return value is ignored. blockparas Used when the "blockparas" option is turned on. Return value is ignored. blockquotes Used when the "blockquotes" option is turned on. Return value is ignored. blockcode Used when the "blockcode" option is turned on. Return value is ignored. urls Turn urls into links when "urls" option is turned on. Should operate on "$self->{html}". Return value is ignored. email Turn email addresses into "mailto:" links when "email" option is turned on. Should operate on "$self->{html}". Return value is ignored. underline Underline things between _underscores_ when "underline" option is turned on. Should operate on "$self->{html}". Return value is ignored. bold Bold things between *asterisks* when "bold" option is turned on. Should operate on "$self->{html}". Return value is ignored. metachars Encode meta characters when "metachars" option is turned on. Should operate on "$self->{html}". Return value is ignored. Output The output from "HTML::FromText" has been updated to pass XHTML 1.1 validation. Every HTML tag that should have a CSS class name does. They are prefixed with "hft-" and correspond to the names of the options to "new()" (or "text2html()"). For example "hft-lines", "hft-paras", and "hft-urls". One important note is the output for "underline". Because the <u> tag is deprecated in this specification a "span" is used with a style attribute of "text-decoration: underline". The class is "hft- underline". If you want to override the "text-decoration" style in the CSS class you'll need to do so like this. text-decoration: none !important; SEE ALSO
text2html(1). AUTHOR
Casey West <casey@geeknest.com>. AUTHOR EMERITUS
Gareth Rees <garethr@cre.canon.co.uk>. COPYRIGHT
Copyright (c) 2003 Casey West. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.8.8 2003-10-14 HTML::FromText(3pm)
All times are GMT -4. The time now is 09:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy