Sponsored Content
Top Forums Shell Programming and Scripting Replace string with sed doesn't work Post 302431259 by vincenty on Monday 21st of June 2010 08:47:51 AM
Old 06-21-2010
Replace string with sed doesn't work

Hello,

Unfortunately I don't found any working solution for my problem :/

I have pass file for dovecot authorizing in this format:

Code:
user@domain.tld:{SSHA}Ykx2KVG/a2FKzjnctFFC2qFnrk9nvRmW:5000:5000::::
.
.
...

Now, I want to write some sh script for password changing for grep'ed user, in this case string: {SSHA}Ykx2KVG/a2FKzjnctFFC2qFnrk9nvRmW

Code:
#!/bin/sh

OLDPW=`grep user@domain.tld passfile | cut -d: -f2`
NEWPW=`dovecotpw -s ssha -p newpassword`

sed -e 's/$OLDPW/$NEWPW/g' passfile > tmpfile
mv tmpfile passfile

but sed command doesn't work. Output file is exactly the same as input. Generated password always starts with {SSHA} and often has special characters like "/" "+", and others...

OS: FreeBSD 8

Any help?... Smilie Thanks!

Last edited by vincenty; 06-21-2010 at 09:53 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed doesn't work

Hello I' m confused a bit. I want to replace string "&amp" with "&" using this command. sed 's/&amp/&/g' and it doesn't work. Nothing happens. On the other side this works: sed 's/&amp/@/g' or sed 's/&amp/^/g' !!! Can somebody help please? Thanks (3 Replies)
Discussion started by: billy5
3 Replies

2. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

3. Shell Programming and Scripting

SED - replace with new line didn´t work for solaris

Hi This is what I was trying to do, comment one line and add something different in a new line right next. This is the command I want to do more .profile | sed 's,STRING1, #STRING1 NEWLINE STRING2,' (I´m using ',' because my string is something like this exec... (3 Replies)
Discussion started by: alcalina
3 Replies

4. Shell Programming and Scripting

Does Sed Search/Replace Work For Multiple Matches On The Same Line?

Hello, I would like to delete all the footnotes in all my htm files. Hence, I have to delete the whole font tag pairs, i.e. deleting everything between the begin/end font tags. I create a testfile, of which data parts of all four lines are the same except for the number of font tag pairs,... (3 Replies)
Discussion started by: cibalo
3 Replies

5. Shell Programming and Scripting

sed replace not work Pls. help me

sed replace not work Pls. help me I used sed command in my file 66875964560@1982589 90825890001@90825890001@3@15/12/2007 14:25:14@22/03/2010 6:06:13@20/01/2010 3:28:39 66873064490@1925912 90259120001@90259120001@5@02/04/2009 1:51:31@30/10/2009 3:08:34@13/09/2009 8:24:33... (3 Replies)
Discussion started by: ooilinlove
3 Replies

6. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

7. Shell Programming and Scripting

sed command works on Fedora/Ubuntu, but doesn't work in Mac

Hi, I have a question. I define a function using sed command: replace() { searchterm=$1 replaceterm=$2 sed -e "s/$searchterm/$replaceterm/ig" $3 > $WORK'tempfile.tmp' mv $WORK'tempfile.tmp' $3 } Then I call replace 'test = 0' 'test = 1' $myfileThis code works well in... (1 Reply)
Discussion started by: Dark2Bright
1 Replies

8. Shell Programming and Scripting

sed command works on Fedora/Ubuntu, but doesn't work in Mac

Hi, I have a question. I define a function using sed command: replace() { searchterm=$1 replaceterm=$2 sed -e "s/$searchterm/$replaceterm/ig" $3 > $WORK'tempfile.tmp' mv $WORK'tempfile.tmp' $3 } Then I call replace 'test = 0' 'test = 1' $myfile This code... (1 Reply)
Discussion started by: Dark2Bright
1 Replies

9. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

10. UNIX for Beginners Questions & Answers

C shell concatenate string doesn't work

I have the following code: #!/bin/csh clear set cloud_file="/home/labs/koren/davidsr/general_scripts/MFP_10_PP_Parmas.txt" # to fill set mie_tables_dir='/home/labs/koren/davidsr/SHDOM_MAIN/MIE_TABLES/non_polo_wave_0.7_water_50R_s0.5_e25_max_70.mie' # to fill set prp_dir='${pp_dir}/pp_prp/'... (2 Replies)
Discussion started by: student_wiz
2 Replies
DOVECOT(1)							      Dovecot								DOVECOT(1)

NAME
dovecot - a secure and highly configurable IMAP and POP3 server SYNOPSIS
dovecot [-Fp] [-c config-file] dovecot -a [-c config-file] dovecot -n [-c config-file] dovecot --build-options dovecot --help dovecot --version dovecot reload dovecot stop DESCRIPTION
Dovecot is an open source IMAP and POP3 server for Linux/UNIX-like systems, written with security primarily in mind. Dovecot is an excel- lent choice for both small and large installations. It's fast, simple to set up, requires no special administration and it uses very lit- tle memory. OPTIONS
-a Dump all configuration settings to stdout and exit successfully. The same as doveconf -a. -c config-file Start dovecot with an alternative configuration. -F Run dovecot in foreground, do not daemonize. -n Dump non-default settings to stdout and exit successfully. The same as doveconf -n. -p Prompt for the ssl key password for the configured ssl_key on startup. --build-options Show Dovecot's build options and exit successfully. --help Print a usage message to stdout and exit successfully. --version Show Dovecot's version and exit successfully. COMMANDS
reload Force dovecot to reload its configuration. stop Shutdown dovecot and all its child processes. When shutdown_clients is set to no, existing sessions will continue to use the old settings, after a dovecot reload. Also all sessions will keep alive after a dovecot stop. By default all active sessions will be shut down. SIGNALS
Dovecot handles the following signals as described: HUP Force dovecot to reload its configuration. INT Shutdown dovecot and all its child processes. TERM Shutdown dovecot and all its child processes. USR1 Force dovecot to reopen all configured log files (log_path, info_log_path and debug_log_path). The signals ALARM and PIPE are ignored. FILES
/etc/dovecot/dovecot.conf Dovecot's main configuration file. /etc/dovecot/dovecot-ldap.conf.ext Dovecot's LDAP authdb/userdb module configuration file. /etc/dovecot/dovecot-sql.conf.ext Dovecot's SQL authdb/userdb module configuration file. /etc/dovecot/dovecot-dict-sql.conf.ext Dovecot's dict configuration with SQL-backend. /etc/dovecot/conf.d/auth-*-conf.ext Configuration files of different authentication modules. /etc/dovecot/conf.d/*.conf Configuration files of different services and settings. REPORTING BUGS
Report bugs, including doveconf -n output, to the Dovecot Mailing List <dovecot@dovecot.org>. Information about reporting bugs is avail- able at: http://dovecot.org/bugreport.html AUTHOR
Dovecot <http://dovecot.org> and its manual pages were written by the Dovecot authors <http://dovecot.org/doc/AUTHORS>, mainly Timo Sir- ainen <tss at iki.fi>, and are licensed under the terms of the MIT and LGPLv2.1 licenses, see <http://dovecot.org/doc/COPYING> for details. SEE ALSO
doveadm(1), doveconf(1), dovecot-lda(1), dsync(1) Dovecot v2.1 2010-07-02 DOVECOT(1)
All times are GMT -4. The time now is 02:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy