LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-17-2002, 06:12 PM   #1
realos
Member
 
Registered: Jul 2002
Location: Germany
Distribution: Redhat 7.3, Debian 3.1, Knoppix 3.1, Ubuntu 6.10
Posts: 113

Rep: Reputation: 15
replacing pattern with sed produces double


hi,

sed 's/family/FAMILY/gp' procmailcopy > procmailcopy_1

replaces the pattern
"family" with
"FAMILY
FAMILY"

whereas I just wanted to replace it with one FAMILY.

Any ideas???
 
Old 10-17-2002, 08:03 PM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
Remove p it prints the replacement as well, hence you got it doubled
sed 's/pattern/PATTERN/g' file_to_read > file_to_write_to
P.S. The reason behind it if p is used on standard output it will print the replaced pattern to standard output, in your case you redirect standard output to a file, so here you got it printed to a file as well.

Last edited by neo77777; 10-17-2002 at 08:06 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
printing pattern match and not whole line that matches pattern Avatar33 Programming 13 05-06-2009 06:17 AM
Replacing "function(x)" with "x" using sed/awk/smth Griffon26 Linux - General 3 11-22-2006 10:47 AM
replacement with sed: replace pattern with multiple lines Hcman Programming 5 11-18-2004 07:40 AM
sed help, replacing a letter with a word GridX Linux - Newbie 1 09-24-2003 10:21 AM
Replacing String with File Content in Sed meshcurrent Linux - General 2 06-01-2003 12:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration