replace hard return followed by a tab
- From: Francois Massion <massion@xxxxxx>
- Date: Sun, 21 Jun 2009 22:43:27 -0700 (PDT)
I have a list of entries in a table which is available as a tab-
separated text. In the first column there is either a string or
nothing, in the second column there is a string.
It looks like this:
Category [Tab] Architecture [Hard return]
[Tab] Technology [Hard return]
[Tab] Medicine [Hard return)
What I want to achieve is:
Category [Tab] Architexture; Technology; Medicine [Hard return]
Here my code:
@entry = <DATA>;
foreach $entry (@entry) {
chomp $entry;
$entry=~ s/(\r|\n){1,}\t/; /mg;
print "$entry\n" ;
}
I have tried different modifiers and more simple replacements like s/\n
\t/; /g;, but to no avail.
Any suggestion?
.
- Follow-Ups:
- Re: replace hard return followed by a tab
- From: sln
- Re: replace hard return followed by a tab
- From: Marc Girod
- Re: replace hard return followed by a tab
- From: Jürgen Exner
- Re: replace hard return followed by a tab
- From: Mathias J. Hennig
- Re: replace hard return followed by a tab
- Prev by Date: suicide attacks is financial confusion issue
- Next by Date: FAQ 4.3 Why isn't my octal data interpreted correctly?
- Previous by thread: suicide attacks is financial confusion issue
- Next by thread: Re: replace hard return followed by a tab
- Index(es):
Relevant Pages
|