ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Yura Kalinichenko <yuk@iceb.vinnitsa.com>
To: michaelholzman@gmail.com,
	AltLinux Community Maillist <community@altlinux.ru>
Subject: Re: [Comm] Что такое subst?
Date: Mon, 19 Sep 2005 20:52:15 +0300
Message-ID: <1127152335.2842.3.camel@yuk.home.int> (raw)
In-Reply-To: <c00cf05091909055921b099@mail.gmail.com>

В Пнд, 19/09/2005 в 19:05 +0300, Michael Holzman пишет:
> On 9/19/05, Eugene Ostapets <eostapets@gmail.com> wrote:
> > Неужели я так невнятно говорю?
> Увы, моего скудного интеллекта не хватило.
> > eostapets@eugene ~/RPM/SOURCES $ rpm -qf `which subst`
> > sed-4.1.4-alt2
> Грубо говоря, мне надо заменить sed. Жалко. На работе мне это не
> позволят. Будем обходиться старыми средствами :'(

Не знаю чего именно вам не хватает, возможно подойдет вот такой скрипт:

#!/bin/sh

if [ $# -lt 3 ]; then
  echo "Usage: subs from_pattern to_pattern files"
  exit 1
fi

pat=$1
shift
topat=$1
shift
files=$*
tf=`mktemp /tmp/subs.XXXXXXXX`
delims="/ ( ) : % & - ="

for c in $delims ; do
  echo -n "$pat" | grep -q $c
  if [ $? -eq 0 ]; then 
     continue
  else
     echo -n "$topat" | grep -q $c
     if [ $? -eq 0 ]; then
        continue
     else
        dm=$c
        break
     fi
  fi
done
if [ -z "$dm" ]; then
   echo "ERROR: no delimiters"
   exit 1
fi

for fn in $files ; do
  grep -q "$pat" $fn
  if [ $? -eq 0 ]; then
     echo $fn: "$pat" --\> "$topat"
     cp $fn ${fn}~
     sed -e "s${dm}$pat${dm}$topat${dm}g" $fn > $tf
     if [ $? -eq 0 ]; then
        mv $tf $fn
     else
        echo "ERROR-ERROR-ERROR-ERROR"
     fi
  fi
done




  parent reply	other threads:[~2005-09-19 17:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-19 15:20 Michael Holzman
2005-09-19 15:25 ` Eugene Ostapets
2005-09-19 15:31   ` Michael Holzman
2005-09-19 15:36     ` Eugene Ostapets
2005-09-19 16:05       ` Michael Holzman
2005-09-19 17:20         ` Eugene Ostapets
2005-09-19 17:52           ` [Comm][JT] " Andrey Rahmatullin
2005-09-19 17:52         ` Yura Kalinichenko [this message]
2005-09-19 18:49         ` [Comm] " Michael Shigorin
2005-09-20  5:40         ` [Comm] " Aleksander N. Gorohovski
2005-09-19 16:03 ` Andrey Rahmatullin
2005-09-19 21:49   ` Vitaly Lipatov
2005-09-20  4:38     ` Andrey Rahmatullin
2005-09-20  9:34       ` [Comm] " Michael Shigorin
2005-09-22 11:56         ` Andrey Rahmatullin
2005-10-22 11:05         ` Andrey Rahmatullin

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=1127152335.2842.3.camel@yuk.home.int \
    --to=yuk@iceb.vinnitsa.com \
    --cc=community@altlinux.ru \
    --cc=michaelholzman@gmail.com \
    /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