On 6/20/06, Sriram Rajagopalan <[EMAIL PROTECTED]> wrote:

Hello,

I have a text file in a columnar format. There are seven entries in a row, separated by tabs.

eg.

1       23      555     34      Corporation     Index   Sediment

This has to be tagged as:

<no>1</no><code>23</code><set>555</set><id>34</id><status>Corporation</status><value>Index</value><type>Sediment</type>

I have stored the file contents to $_ and I am using the regex

$_=~s/([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t/<no>$1<\/no><code>$2<\/code><set>$3<\/set><id>$4<\/id><status>$5<\/status><value>$6<\/value><type>$7<\/type>/g;

I am not able to get the text tagged. Can anyone help me out to get my desired codes?

Your regex is expecting a tab after Sediment.  Is there one?

--
Brad

Reply via email to