From: Slava Dubrovskiy <slava@tangramltd.com>
To: ALT Linux Community <community@lists.altlinux.org>
Subject: Re: [Comm] Помогите с форматированием текста
Date: Wed, 28 Mar 2007 08:37:31 +0300
Message-ID: <4609FF1B.5000706@tangramltd.com> (raw)
In-Reply-To: <e12fd2db0703270747l364115eo27c72e461c3be639@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 928 bytes --]
Eugene Ostapets пишет:
>> Здравствуйте.
>> И на bash не работает :-(
>> while [ "$name" != Smith ]; do
>> read name
>> long=`echo $name | wc -m`
>> if [[ $long = "76" ]]; then
>> name=`echo $name | sed 's/\n//'`
>> fi
>> echo "$name"
>>
> Он выводит два перевода строк? Если один - echo -n $name :)
>
Все разобрался на свежую голову. Ночью я понял что вы имели в виду.
Просто я забыл, что это echo сам переводит строку без -n.
Рабочий вариант выглядит так:
#!/bin/bash
while read line ;do
len=${#line}
if [ "$len" -eq 76 ]; then
echo -n "$line"
else
echo "$line"
fi
done
exit 0
И без всяких td, sed, awk и т.д :-)
Спасибо большое.
--
WBR,
Dubrovskiy Vyacheslav
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3249 bytes --]
next prev parent reply other threads:[~2007-03-28 5:37 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 [this message]
2007-03-27 20:14 ` Yura Kalinichenko
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=4609FF1B.5000706@tangramltd.com \
--to=slava@tangramltd.com \
--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