* Re: [room] Помогите с регулярным выражением
@ 2013-05-14 14:48 ` Nikolay A. Fetisov
0 siblings, 0 replies; only message in thread
From: Nikolay A. Fetisov @ 2013-05-14 14:48 UTC (permalink / raw)
To: smoke-room
В Вт, 14/05/2013 в 17:27 +0400, Aleksey Birukov пишет:
> Есть такой вот текст:
....
>
>
>
> Как извлечь текст между "***"? Мне нужно поместить эти параграфы
> каждый отдельно в массив или в базу.
>
> Хотелось бы использовать sed, awk, grep, cut и т.п.
Достаточно одного awk:
awk 'BEGIN{i=0} {if (/^\*\*\*$/) {i+=1;} else {print >> "p."i}}' file
Куски файла file - в файлах p.N .
--
С уважением,
Николай Фетисов
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-05-14 14:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-14 14:48 ` [room] Помогите с регулярным выражением Nikolay A. Fetisov
Культурный офтопик
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/smoke-room/0 smoke-room/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 smoke-room smoke-room/ http://lore.altlinux.org/smoke-room \
smoke-room@lists.altlinux.org smoke-room@lists.altlinux.ru smoke-room@lists.altlinux.com smoke-room@altlinux.ru smoke-room@altlinux.org smoke-room@altlinux.com
public-inbox-index smoke-room
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.smoke-room
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git