Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stripping quotes from around fields. 1

Status
Not open for further replies.

cuttersw

IS-IT--Management
Aug 10, 2006
9
US
Can anyone suggest a simple way to only return data that exists between quotes within a field.

EG of data set:

[tt]
Mailbox}@{JohnD}@{John Doe}@{john.doe@domain.com%jd@domain.com%jd@dom2.com}@{y
Mailbox}@{MaryS}@{“Smith, Mary”}@{smithm@domain.com}@{y
Mailbox}@{BudH}@{Bud Holly}@{BudH@domain.com%bud.holly@domain2.com}@{y
[/tt]
[small]The FieldDelimiter is "}@{"[/small]

Notice that the 3rd field of the 2nd record is embedded in quotes.

Currently I am using a combination of substr() and index() functions to remove the quotes but its messy and slow!


Regards,

Shaun
 
...I have managed to improve the above to this:

[tt] mbname=$3
if (mbname ~ /^\"/) {
split($3,xxx,"\"")
mbname=xxx[2]
}[/tt]

Is that as efficent as it gets or am i still missing a simpler solution?
 
Ahhhhh - that's much better!

- Thanks very much futurelet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top