| От | Adriaan Joubert |
|---|---|
| Тема | Re: [GENERAL] Desperately Seeking Regular Expression |
| Дата | |
| Msg-id | 3725C3C3.2D9F32B0@albourne.com обсуждение исходный текст |
| Ответ на | Desperately Seeking Regular Expression (Thomas Good <tomg@q8.nrnet.org>) |
| Список | pgsql-general |
I solved something like this recently in perl. It's not terribly
efficient, but it is simple. I'm doing this from memory, so it may need
some debugging. Use something along the lines of
#!/usr/local/bin/perl
while (<>) {
@a = split /(\")/;
# This gives you a list with some of the items being double-quotes
# Now you need to figure out which ones were inside double quotes
my $b;
if ($a[0] eq '"') {
# we started with a double quoted string, so join th e 1st 3 fields
# and stick them on the new string
$b = join('',splice(@a,0,3))."\t";
}
while (@a) {
$b .= join("\t",split(' ',shift @a))."\t";
# if there is more then we have another double quoted string
$b = join('',splice(@a,0,3))."\t" if @a;
}
# Remove the last tab and replace with a newline
$b =~ s/\t$/\n/;
print $b;
}
Adriaan
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера