ALT Linux sysadmins discussion
 help / color / mirror / Atom feed
From: "Peter V. Saveliev" <peet@altlinux.ru>
To: ALT Linux sysadmin discuss <sysadmins@lists.altlinux.org>
Subject: Re: [Sysadmins] использование конструкций циклов в правилах firewall в etcnet
Date: Mon, 22 Oct 2007 11:30:58 +0400
Message-ID: <200710221130.58912.peet@altlinux.ru> (raw)
In-Reply-To: <471BBF39.3000401@gmail.com>

<skip />

[peet@kelisaari peet]$ echo  -e "поросёнок N#{0-12} умер\nвсе поросята умерли :(" | ./bala.sh
поросёнок N0 умер
поросёнок N1 умер
поросёнок N2 умер
поросёнок N3 умер
поросёнок N4 умер
поросёнок N5 умер
поросёнок N6 умер
поросёнок N7 умер
поросёнок N8 умер
поросёнок N9 умер
поросёнок N10 умер
поросёнок N11 умер
поросёнок N12 умер
все поросята умерли :(


[peet@kelisaari peet]$ cat bala.sh
#!/bin/sh



while read bala; do {

        r='s/\(.*\)#{\([0-9]\+\)-\([0-9]\+\)}\(.*\)/\'

        a=`echo $bala | sed -n $r"1/p"`
        b=`echo $bala | sed -n $r"2/p"`
        c=`echo $bala | sed -n $r"3/p"`
        d=`echo $bala | sed -n $r"4/p"`

        if [ -z "$b" -o -z "$c" ]; then {
                echo $bala
        } else {
                for i in $(seq $b $c); do {
                        echo $a$i$d
                } done
        } fi

} done


ЗЫ: но имхо -- всё это порядочный изврат.
-- 
Peter V. Saveliev

  parent reply	other threads:[~2007-10-22  7:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-21 16:29 Kompan Serge
2007-10-21 19:59 ` Andrew Kornilov
2007-10-21 20:35   ` Peter V. Saveliev
2007-10-21 21:06     ` Andrew Kornilov
2007-10-21 21:46       ` Peter V. Saveliev
2007-10-22  6:42       ` ABATAPA
2007-10-22  6:53         ` Peter V. Saveliev
2007-10-22  7:30       ` Peter V. Saveliev [this message]
2007-10-22 11:38         ` Andrew Kornilov
2007-10-22 17:45           ` Peter V. Saveliev
2007-10-22 22:20             ` Andrew Kornilov
2007-10-22 22:44               ` Andrew Kornilov
2007-10-23 13:29               ` Serge
2007-10-23 20:35                 ` Andrew Kornilov

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=200710221130.58912.peet@altlinux.ru \
    --to=peet@altlinux.ru \
    --cc=sysadmins@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 sysadmins discussion

This inbox may be cloned and mirrored by anyone:

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

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


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