Hi,
I just stuckup in doing some regular expressions on a file.
I have data which has multiple FHS and BTS segments like:
FHS|12121|LOCAL|2323
MSH|10101|POTAMAS|2323
PID|121221|THOMAS|DAVID|23432
OBX|2342|H1211|3232
BTS|0000|MERSTO|LIABLE
FHS|12121|LOCAL|2323
MSH|10101|POTAMAS|2323... (3 Replies)
Hi - I tried to remove ^M in a delimited file using "tr -d "\r" and "sed 's/^M//g'", but it does not work quite well. While the ^M is removed, the format of the record is still cut in half, like
a,b, c
c,d,e
The delimited file is generated using sh script by outputing a SQL query result to... (7 Replies)
Hi Experts
I am very new to perl and need to make a script using perl.
I would like to remove blanks in a text tab delimited file in in a specfic column range ( colum 21 to column 43) sample input and output shown below :
Input:
117 102 650 652 654 656
117 93 95... (3 Replies)
Hi Guys,
Happy New Year to you all!
I have a requirement to read an embedded new-line using KSH's read builtin.
Here is what I am trying to do:
run_sql "select guestid, address, email from guest" | while read id addr email
do
## Biz logic goes here
done
I can take care of any... (6 Replies)
Hi Gurus,
Apologies as I feel like this must be answered already on here somewhere but I just can't find it. I find many people looking to remove all \n and \r (CR and LF) or one or the other but the only times I've found someone trying to remove them only when both are together they've found... (7 Replies)
Greetings all,
i have csv file with pipe separated columns
SSN|NAME|ADDRESS|FILLER
123|abc|myaddress|xxx
234|BBB|my
add
ress
broken up|yyy
In the example above, the second record is broken into multiple lines. I need to keep going until I find a "|" since this issue is with the... (14 Replies)
I'm trying to remove all of the empty lines at the end of a Tab delimited file. They have no data just tabs.
I've tried may things, here are a couple:
sed /^\t.\t/d File1 > File2
sed /^\t{44}/d File1 > File2
What am I missing? (9 Replies)
Hello,
I have a very large dictionary file which is in text format and which contains a large number of sub-sections. Each sub-section starts with the following header :
#DATA
#VALID 1
and ends with a footer as shown below
#END
The data between the Header and the Footer consists of... (6 Replies)
Hi below is my file.
cat input.dat
101,abhilash,1000
102,prave
en,2000
103,partha,4
000
10
4,naresh,5000
(its just a example file)
and my output should be:
101,abhilash,1000
102,praveen,2000
103,partha,4000
104,naresh,5000
below is my code
cat input.dat |tr -d '\n' >... (6 Replies)
Hi guys,Got a bit of a bind I'm in. I'm looking to remove duplicates from a pipe delimited file, but do so based on 2 columns. Sounds easy enough, but here's the kicker...
Column #1 is a simple ID, which is used to identify the duplicate.
Once dups are identified, I need to only keep the one... (2 Replies)
Discussion started by: kevinprood
2 Replies
LEARN ABOUT DEBIAN
uri::find::delimited
URI::Find::Delimited(3pm) User Contributed Perl Documentation URI::Find::Delimited(3pm)NAME
URI::Find::Delimited - Find URIs which may be wrapped in enclosing delimiters.
DESCRIPTION
Works like URI::Find, but is prepared for URIs in your text to be wrapped in a pair of delimiters and optionally have a title. This will be
useful for processing text that already has some minimal markup in it, like bulletin board posts or wiki text.
SYNOPSIS
my $finder = URI::Find::Delimited->new;
my $text = "This is a [http://the.earth.li/ titled link].";
$finder->find($text);
print $text;
METHODS
new
my $finder = URI::Find::Delimited->new(
callback => &callback,
delimiter_re => [ '[', ']' ],
ignore_quoted => 1 # defaults to 0
);
All arguments are optional; defaults are provided (see below).
Creates a new URI::Find::Delimited object. This object works similarly to a URI::Find object, but as well as just looking for URIs it
is also aware of the concept of a wrapped, titled URI. These look something like
[http://foo.com/ the foo website]
where:
* "[" is the opening delimiter
* "]" is the closing delimiter
* "http://foo.com/" is the URI
* "the foo website" is the title
* the URI and title are separated by spaces and/or tabs
The URI::Find::Delimited object will extract each of these parts separately and pass them to your callback.
callback
"callback" is a function which is called on each URI found. It is passed five arguments: the opening delimiter (if found), the
closing delimiter (if found), the URI, the title (if found), and any whitespace found between the URI and title.
The return value of the callback will replace the original URI in the text.
If you do not supply your own callback, the object will create a default one which will put your URIs in 'a href' tags using the
URI for the target and the title for the link text. If no title is provided for a URI then the URI itself will be used as the
title. If the delimiters aren't balanced (eg if the opening one is present but no closing one is found) then the URI is treated as
not being wrapped.
Note: the default callback will not remove the delimiters from the text. It should be simple enough to write your own callback to
remove them, based on the one in the source, if that's what you want. In fact there's an example in this distribution, in
"t/delimited.t".
delimiter_re
The "delimiter_re" parameter is optional. If you do supply it then it should be a ref to an array containing two regexes. It
defaults to using single square brackets as the delimiters.
Don't use capturing groupings "( )" in your delimiters or things will break. Use non-capturing "(?: )" instead.
ignore_quoted
If the "ignore_quoted" parameter is supplied and set to a true value, then any URIs immediately preceded with a double-quote char-
acter will not be matched, ie your callback will not be executed for them and they'll be treated just as normal text.
This is kinda lame but it's in here because I need to be able to ignore things like
<img src="http://foo.com/bar.gif">
A better implementation may happen at some point.
SEE ALSO
URI::Find.
AUTHOR
Kake Pugh (kake@earth.li).
COPYRIGHT
Copyright (C) 2003 Kake Pugh. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
CREDITS
Tim Bagot helped me stop faffing over the name, by pointing out that RFC 2396 Appendix E uses "delimited". Dave Hinton helped me fix the
regex to make it work for delimited URIs with no title. Nick Cleaton helped me make "ignore_quoted" work. Some of the code was taken from
URI::Find.
perl v5.8.8 2008-03-01 URI::Find::Delimited(3pm)