Sponsored Content
Top Forums Shell Programming and Scripting Find and replace data in text file with data in same file Post 302379019 by timothyha22 on Wednesday 9th of December 2009 03:28:55 PM
Old 12-09-2009
Find and replace data in text file with data in same file

OK I will do my best to explain what I need help with.

I am trying to format an ldif file so I can import it into Oracle oid.

I need the file to look like this example. Keep in mind there are 3000 of these in the file.

Code:
 
changetype: modify
replace: userpassword 
dn: cn=4448322,cn=Users,dc=bennettware,dc=com
userpassword: {SHA}r+uU3mySUIISdVdTDvQxPRLdBFj5w=
-
replace: passwordexpiretime
passwordexpiretime: 20091031112231
-
replace: orclpassword
orclpassword: {x- orcldbpwd}1.0:83sdfdf24977D14AA
 
changetype: modify
replace: userpassword 
dn: cn=213333,cn=Users,dc=bennettware,dc=com
userpassword: {SHA}r+ukljasdfl;kjafdVdTDvQxPRLdBFj5w=
-
replace: passwordexpiretime
passwordexpiretime: 20091031112231
-
replace: orclpassword
orclpassword: {x- orcldbpwd}1.0:835sdff4977D14AA

I have it to this point. Please keep in mind sometimes the userpassword: encrypted pass is in different places in the string of each user. Notice the userpassword: enc pass is not under the dn: line.

Code:
changetype: modify
replace: userpassword
dn: cn=418322,cn=Users,dc=bennettware,dc=com
-
replace: orclpassword
userpassword: {SHA}B6UenM9qwerwerews3V5ve8H3H0=
orclpassword: {x- orcldbpwd}1.0:8359A824977D14AA
-
replace: passwordexpiretime
passwordexpiretime: 20091031112231

The long and short is I need to move the "userpassword: encryptep pass" up to directly under the dn field for each record. Is there anyway I can do this with awk or sed or something.

Any help would be greatly appreciated.

Tim

---------- Post updated at 03:28 PM ---------- Previous update was at 09:49 AM ----------

I found a work around.

Thanks for the consideration.

Tim

Last edited by zaxxon; 12-09-2009 at 10:50 AM.. Reason: code tags please
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting data from text file based on configuration set in config file

Hi , a:) i have configuration file with pattren <Range start no>,<Range end no>,<type of records to be extracted from the data file>,<name of the file to store output> eg: myfile.confg 9899000000,9899999999,DATA,b.dat 9899000000,9899999999,SMS,a.dat b:) Stucture of my data file is... (3 Replies)
Discussion started by: suparnbector
3 Replies

2. Shell Programming and Scripting

Find lines in text file with certain data in first field

Hi all, Sorry for the title, I was unsure how to word my issue. I'll get right to the issue. In my text file, I need to find all lines with the same data in the first field. Then I need to create a file with the matching lines merged into one. So my original file will look something like... (4 Replies)
Discussion started by: rstev39147
4 Replies

3. Shell Programming and Scripting

Replace data of one column with data on other file corresponding to transaction ID matched

Hi All, I have two files one of which having some mobile numbers and corresponding value whose sample content as follows: 9058629605,8.0 9122828964,30.0 And in second file complete details of all mobile numbers and sample content as follows and delimeter used is comma(,): ... (8 Replies)
Discussion started by: poweroflinux
8 Replies

4. Shell Programming and Scripting

find string(s) in text file and nearby data, export to list help

Hi, So I'm kinda new to shell scripts and the like. I've picked up quite a bit of use from browsing the forums here but ran into a new one that I can't seem to find an answer for. I'm looking to parse/find a string AND the next 15 or so charachters that follow the string within a text file... (1 Reply)
Discussion started by: kar23me
1 Replies

5. Shell Programming and Scripting

Filter a .kml file (xml) with data set from text file

I have a .kml file. So I want filter the .kml to get only the tags that have this numeric codes that they are in a text file 11951 11952 74014 11964 11965 11969 11970 11971 11972 60149 74018 74023 86378 11976 11980 11983 11984 11987 (5 Replies)
Discussion started by: pcoj33
5 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

Replace data of a file with data from another file using shell scripting.

Dears, I'm new to shell scripting and i was wondering if you can help me with following matter. I have a file containing 400,000 records. The file contains two columns like: 00611291,0270404000005453 25262597,1580401000016155 25779812,1700403000001786 00388934,1200408000000880... (1 Reply)
Discussion started by: paniklas
1 Replies

8. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

9. 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

10. Shell Programming and Scripting

awk script to find data in three file and perform replace operation

Have three files. Any other approach with regards to file concatenation or splitting, etc is appreciated If column55(billngtype) of file1 contains YMNC or YPBC then pick the value of column13(documentnumber). Now find this documentnumber in column1(Billdoc) of file2 and grep the corresponding... (4 Replies)
Discussion started by: as7951
4 Replies
asadmin-create-file-user(1AS)					   User Commands				     asadmin-create-file-user(1AS)

NAME
asadmin-create-file-user, create-file-user - createsa new file user SYNOPSIS
create-file-user --user admin_user [--password admin_password] [--host localhost][--port 4848] [--secure|-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive=true] [--userpassword user_password] [--groups user_groups:[user_groups]*] [--authrealmname auth_realm_name] user_name Creates an entry in keyfile with the specified username, userpassword, and groups. Multiple groups can be created by separating them with a colon ":". If the auth_realm_name is not specified, an entry is created in the default keyfile. If auth_realm_name is specified, an entry is created in the keyfile where the auth-realm name in the domain.xml file points to. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. --userpassword password for the file user. --groups group where the file user belongs to. --authrealmname name, in the domain.xml file, where you have different stores for file auth realm. OPERANDS
user_name name of file user to be created. EXAMPLES
Example 1: Using the create-file-user command It is assumed that an authority realm has already been created using the create-auth-realm command. asadmin> create-file-user --user admin1 --password adminadmin1 --host pigeon --port 5001 --userpassword sample --groups staff:manager --authrealmname auth-realm1 sample_user Command create-file-user executed successfully Where: the sample_user is the file user created. EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-auth-realm(1AS)asadmin-delete-file-user(1AS), asadmin-list-file-users(1AS), asadmin-update-file-user(1AS), asadmin- list- file-groups(1AS) J2EE 1.4 SDK March 2004 asadmin-create-file-user(1AS)
All times are GMT -4. The time now is 02:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy