* [Comm] sed замена слова
@ 2002-10-11 10:41 Прокопьев Евгений
2002-10-11 10:45 ` Igor Homyakov
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Прокопьев Евгений @ 2002-10-11 10:41 UTC (permalink / raw)
To: community
Здравствуйте!
Как заменть в файле одно слово на другое, но при этом вывести не
измененную строку, а весь файл?
[john@john john]$ sed -n 's/\$DBNAME/dbname/p'
/opt/scripts/sql/metadata.sql
CREATE DATABASE 'localhost:/var/db/web/dbname.gdb'
[john@john john]$ sed -n 's/\$DBNAME/dbname/1,$p'
/opt/scripts/sql/metadata.sql
sed: -e expression #1, char 20: Unknown option to 's'
--
С уважением, Прокопьев Евгений
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] sed замена слова
2002-10-11 10:41 [Comm] sed замена слова Прокопьев Евгений
@ 2002-10-11 10:45 ` Igor Homyakov
2002-10-11 10:53 ` Korshunov Ilya
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Igor Homyakov @ 2002-10-11 10:45 UTC (permalink / raw)
To: community
On Fri, Oct 11, 2002 at 02:41:14PM +0400, Прокопьев Евгений wrote:
> Здравствуйте!
>
> Как заменть в файле одно слово на другое, но при этом вывести не
> измененную строку, а весь файл?
>
> [john@john john]$ sed -n 's/\$DBNAME/dbname/p'
> /opt/scripts/sql/metadata.sql
> CREATE DATABASE 'localhost:/var/db/web/dbname.gdb'
>
> [john@john john]$ sed -n 's/\$DBNAME/dbname/1,$p'
> /opt/scripts/sql/metadata.sql
> sed: -e expression #1, char 20: Unknown option to 's'
$ sed -n 's/\$DBNAME/dbname/; 1,$p' /opt/scripts/sql/metadata.sql
--
Igor Homyakov
<homyakov at altlinux dot ru>
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=190141
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] sed замена слова
2002-10-11 10:41 [Comm] sed замена слова Прокопьев Евгений
2002-10-11 10:45 ` Igor Homyakov
@ 2002-10-11 10:53 ` Korshunov Ilya
2002-10-11 11:04 ` Sergey Bolshakov
2002-10-11 11:32 ` Прокопьев Евгений
3 siblings, 0 replies; 6+ messages in thread
From: Korshunov Ilya @ 2002-10-11 10:53 UTC (permalink / raw)
To: community
В сообщении от 11 Октябрь 2002 14:41 Прокопьев Евгений написал:
> Здравствуйте!
>
> Как заменть в файле одно слово на другое, но при этом вывести не
> измененную строку, а весь файл?
>
> [john@john john]$ sed -n 's/\$DBNAME/dbname/p'
> /opt/scripts/sql/metadata.sql
> CREATE DATABASE 'localhost:/var/db/web/dbname.gdb'
>
> [john@john john]$ sed -n 's/\$DBNAME/dbname/1,$p'
> /opt/scripts/sql/metadata.sql
> sed: -e expression #1, char 20: Unknown option to 's'
Дык наверно cat file |sed замены ?
--
WBR
Korshunov Ilya
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] sed замена слова
2002-10-11 10:41 [Comm] sed замена слова Прокопьев Евгений
2002-10-11 10:45 ` Igor Homyakov
2002-10-11 10:53 ` Korshunov Ilya
@ 2002-10-11 11:04 ` Sergey Bolshakov
2002-10-11 11:32 ` Прокопьев Евгений
3 siblings, 0 replies; 6+ messages in thread
From: Sergey Bolshakov @ 2002-10-11 11:04 UTC (permalink / raw)
To: community
>>>>> "john" == john <john@rmts.donpac.ru> writes:
> Здравствуйте! Как заменть в файле одно слово на другое, но при этом
> вывести не измененную строку, а весь файл?
[me@pc313 me]$ cat <<EOF|sed 's|\(^.\+\)\{0\}Pupkin\(.\+$\)\{0\}|\1Popkin\2|'
> Petrov
> Vasisualy Pupkin-Lohankin
> Vasechkin
> EOF
Petrov
Vasisualy Popkin-Lohankin
Vasechkin
[me@pc313 me]$
--
Трули ерз, Сергей.
"[Open Source] programming is like sex, one mistake and you have to support it
for the rest of your life." --- M. Sinz, CBM Inc.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] sed замена слова
2002-10-11 10:41 [Comm] sed замена слова Прокопьев Евгений
` (2 preceding siblings ...)
2002-10-11 11:04 ` Sergey Bolshakov
@ 2002-10-11 11:32 ` Прокопьев Евгений
2002-10-11 11:38 ` Прокопьев Евгений
3 siblings, 1 reply; 6+ messages in thread
From: Прокопьев Евгений @ 2002-10-11 11:32 UTC (permalink / raw)
To: community
Эх вы, умники :-)
sed 's/\$DBNAME/dbname/p' - догадался методом тыка
--
С уважением, Прокопьев Евгений
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-10-11 11:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-11 10:41 [Comm] sed замена слова Прокопьев Евгений
2002-10-11 10:45 ` Igor Homyakov
2002-10-11 10:53 ` Korshunov Ilya
2002-10-11 11:04 ` Sergey Bolshakov
2002-10-11 11:32 ` Прокопьев Евгений
2002-10-11 11:38 ` Прокопьев Евгений
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