Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Modifying a particulae data in a line contained in File Post 302359099 by TonyFullerMalv on Monday 5th of October 2009 07:49:57 PM
Old 10-05-2009
Something like this would do the trick:
Code:
sed '/userid/s/oldpasswd/newpasswd/' inputfile > tempfile && \
cp tempfile inputfile && \
rm tempfile

Where the /userid/ means that the sed statement will only replace (substitute) "oldpasswd" with "newpasswd" for the userid given and not any other.

Is that what you are after?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find a string under a directory that is contained in another file

Hi I am loking for some help in writing a script that will take a number that is located in one file and search a folder structure for that string in any file under that directory. I can do this manually with : find /"directory" -type f -exec grep -l 'Number String' {} \; But now I will... (3 Replies)
Discussion started by: BMC
3 Replies

2. Shell Programming and Scripting

File renaming from list of names contained in another file

I have to rename a large number of files so that the name of each file corresponds to a code number that is given side by side in a list (textfile). The list contains in column A the filename of the actual files to be renamed and in column B the name (a client code, 9 digits) that has to be... (7 Replies)
Discussion started by: netfreighter
7 Replies

3. Shell Programming and Scripting

Modifying data within the same line

My file looks like this But I need to move the frequency value (Freq) to the second position, leaving intact the numbers at the top. The resulting file should look like this Thanks in advance! (3 Replies)
Discussion started by: Xterra
3 Replies

4. Shell Programming and Scripting

Searching for a particular string and modifying text within block of data

Hi Forum. Is there a quick way to do the following search/replace within a block of data? I tried to google the solution but didn't really know what to look for. I have the following text file (I want to search for a particular string "s_m_f_acct_txn_daily_a1" and replace the... (5 Replies)
Discussion started by: pchang
5 Replies

5. AIX

Find the patch that contained a particular file.

Hi All, I have an AIX executable (/usr/bin/shell) in my system. I want to know if this file was updated by any of the installed fixes/apars on my system. What is the AIX way of finding this information? Greetings, Peter (1 Reply)
Discussion started by: petervg
1 Replies

6. UNIX for Dummies Questions & Answers

Mapping a data in a file and delete line in source file if data does not exist.

Hi Guys, Please help me with my problem here: I have a source file: 1212 23232 343434 ASAS1 4 3212 23232 343434 ASAS2 4 3234 23232 343434 QWQW1 4 1134 23232 343434 QWQW2 4 3212 23232 343434 QWQW3 4 and a mapping... (4 Replies)
Discussion started by: kokoro
4 Replies

7. Shell Programming and Scripting

Capture string contained on a line?

Hello All, I'm working on a script that runs the wget command on a list of IP Address in order to capture the data at that address' index.html. That part works fine to get the HTML code at that address but the data I'm trying to pull out is on a line containing a BUNCH of code for an HTML... (4 Replies)
Discussion started by: mrm5102
4 Replies

8. Shell Programming and Scripting

Modifying file from command line using Perl

Hi all, I am having a slight issue updating a file using perl from the command line I need some help with. The item is: DATA_FILE_TYPE=FULL When I run the below command /usr/bin/perl -p -i -e "s/DATA_FILE_TYPE=/DATA_FILE_TYPE=APPEND/g" processfile.cfg It looks to be... (2 Replies)
Discussion started by: kstevens67
2 Replies

9. Shell Programming and Scripting

Modifying bash script to take each line in a file and execute command

I need to modify a bash script to to take each line in a file and execute command. I currently have this: #!/bin/bash if ; then echo "Lipsa IP"; exit; fi i=1 ip=$1 while ; do if ; then rand=`head -$i pass_file | tail -1` user=`echo $rand | awk '{print $1}'` pass=`echo $rand | awk '{print $2}'`... (3 Replies)
Discussion started by: galford
3 Replies

10. Shell Programming and Scripting

Modifying text file records, find data in one place in the record and print it elsewhere

Hello, I have some text data that is in the form of multi-line records. Each record ends with the string $$$$ and the next record starts on the next line. RDKit 2D 15 14 0 0 0 0 0 0 0 0999 V2000 5.4596 2.1267 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 ... (5 Replies)
Discussion started by: LMHmedchem
5 Replies
Net::LDAP::Extension::SetPassword(3pm)			User Contributed Perl Documentation		    Net::LDAP::Extension::SetPassword(3pm)

NAME
Net::LDAP::Extension::SetPassword - LDAPv3 Modify Password extension object SYNOPSIS
use Net::LDAP; use Net::LDAP::Extension::SetPassword; $ldap = Net::LDAP->new( "ldap.mydomain.eg" ); $ldap->bind('cn=Joe User,cn=People,dc=mydomain,dc=eg", password => 'oldPassword'); $mesg = $ldap->set_password( oldpasswd => 'oldPassword' ); die "error: ", $mesg->code(), ": ", $mesg->error() if ($mesg->code()); print "changed your password to", $mesg->gen_password() , " "; DESCRIPTION
"Net::LDAP::Extension::SetPassword" implements the "Modify Password" extended LDAPv3 operation as described in RFC 3062. It implements no object by itself but extends the Net::LDAP object by another method: METHODS
set_password ( OPTIONS ) Set the password for a user. OPTIONS is a list of key/value pairs. The following keys are recognized: user If present, this option contains the octet string representation of the user associated with the request. Depending on how users are identified in the directory this string may or may not be a DN according to RFC 2253. If this option is not present, the request acts up upon the password of the user currently associated with the LDAP session. oldpasswd This option, if present, must contain the current password of the user for whom this operation is performed. It depends on the server's implementation in which cirumstances this option is allowed to be missing. newpasswd If present, this option contains the desired password for the user for whom the operation is performed. Depending on the server's implementation this option may be required by the LDAP server. gen_password ( ) Return the password generated by the server in response to the "set_password()" call when applicable. The server will not generate a new password if "newpasswd" was passed to "set_password()". This method is a method of the Net::LDAP::Message response object returned in reply to "set_password()" in case the "set_password()" call succeeded. By this method the caller can query for the value of the password in case he did not call "set_password()" with the "newpasswd" option. SEE ALSO
Net::LDAP, Net::LDAP::Extension AUTHOR
Graham Barr <gbarr@pobox.com>, documentation by Peter Marschall <peter@adpm.de>. Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org> COPYRIGHT
Copyright (c) 2002-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-29 Net::LDAP::Extension::SetPassword(3pm)
All times are GMT -4. The time now is 06:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy