ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Yura Kalinichenko <yuk@kalina.in.ua>
To: ALT Linux Community <community@lists.altlinux.org>
Subject: Re: [Comm] Помогите с форматированием текста
Date: Tue, 27 Mar 2007 23:14:51 +0300
Message-ID: <46097B3B.6050009@kalina.in.ua> (raw)
In-Reply-To: <46092A9F.4010107@tangramltd.com>

Slava Dubrovskiy пишет:
> Здравствуйте.
>
> Помогите со скриптом. В сети есть много скриптов, которые форматируют 
> текст, разбивая строку на несколько до определённой длины строки. 
> Подскажите, а как можно вернуть обратно?
>
> Подозреваю что нужно использовать sed, но не могу понять, как ему 
> сказать, что если длина строки, например 76  символов, то объединить 
> её с следующей?
Вы выбрали не совсем подходящий инструмент. В shell-скриптах для таких 
целей обычно применяют awk или perl, например:

cat file.ext | awk 'BEGIN {found=0} 
{ if (found==1) {
     found=0 ; 
     printf $0
  } else {
     if (length()==76) {
        found=1 ; 
        printf "%s",$0 ;
     } else print $0
  }
}
END {if (found==1) printf "\n"}'


-- 
 Yura Kalinichenko



      parent reply	other threads:[~2007-03-27 20:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-27 14:30 Slava Dubrovskiy
2007-03-27 14:47 ` Eugene Ostapets
2007-03-27 15:15   ` Slava Dubrovskiy
2007-03-27 15:47     ` Eugene Ostapets
2007-03-27 16:08       ` Slava Dubrovskiy
2007-03-28  5:37   ` Slava Dubrovskiy
2007-03-27 20:14 ` Yura Kalinichenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46097B3B.6050009@kalina.in.ua \
    --to=yuk@kalina.in.ua \
    --cc=community@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/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 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git