How to append an entry?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to append an entry?
# 1  
Old 02-20-2013
Oracle How to append an entry?

Hi

i have following sample entry--Each entry has 7-9 lines. Below entry has 7 lines.

I have a file it contains 1000's of such entries and each entry has 7-9 lines.

Input:
Code:
dn:cn=aci,cn=index,cn=example,cn=ldbm database, cn=plugins,cn=config
objectClass: top
objectClass: extensibleObject
objectClass: nsIndex
cn: aci
nsSystemIndex: true
nsIndexType: pres

I need output as below:
Code:
dn:cn=aci,cn=index,cn=example,cn=ldbm database, cn=plugins,cn=config
changetype: add
objectClass: top
objectClass: extensibleObject
objectClass: nsIndex
cn: aci
nsSystemIndex: true
nsIndexType: pres


Last edited by Franklin52; 02-21-2013 at 03:25 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 02-20-2013
With sed:

Code:
sed 's/^dn:.*/&\
changetype: add/' infile

# 3  
Old 02-20-2013
Code:
awk '/^dn:cn/{$0=$0 RS "changetype: add"}1' file

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

Cron entry

Hi I have a system running solaris 11, in which I am able to execute a script from the command line, but once I put i the crontab does run, but do not give results. The entry is: 15 11 * * * /var/oswbb/./startOSWbb.sh >> myjob.log 2>&1 30 11 * * * /var/oswbb/./stopOSWbb.sh I have check... (2 Replies)
Discussion started by: fretagi
2 Replies

2. Shell Programming and Scripting

How to replace multiple "&nbsp;" entry with in <td> tag into single entry using sed?

I have the input file like this. Input file: 12.txt 1) There are one or more than one <tr> tags in same line. 2) Some tr tags may have one <td> or more tna one <td> tags within it. 3) Few <td> tags having "<td> &nbsp; </td>". Few having more than one "&nbsp;" entry in it. <tr> some td... (4 Replies)
Discussion started by: thomasraj87
4 Replies

3. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

4. UNIX for Dummies Questions & Answers

Crontab entry

Is this the correct entry to touch a file on 6/6 5AM? 00 05 06 06 * touch /support/home/.no_copy Please use next time code tags for your code and data (5 Replies)
Discussion started by: Me XMan
5 Replies

5. Solaris

cron entry

Hi, I have to add two cron entry now. Please correct me if anything wrong Below script should run at every one and half hour. 30 01 * * * /export/home/gxadm/scripts/collect_mq_info.pl $HOME/GCSS/logs > /dev/null 2>&1 Below script should run at every 2 hours 0 02 * * *... (9 Replies)
Discussion started by: Mani_apr08
9 Replies

6. Solaris

crontab entry

hi i am new in solaris. i am accessing server through putty. i could not add entry in crontab. i have given "crontab -e" for add a new entry. It is not coming. what parameter i have to set for getting crontab -e thanks (1 Reply)
Discussion started by: sunnybee
1 Replies

7. UNIX for Dummies Questions & Answers

Crontab entry

What should be the crontab entry for a script: to run at 3:00 AM EST Sun, Mon, Tue, Wed, Thu, Fri (3 Replies)
Discussion started by: proactiveaditya
3 Replies

8. Shell Programming and Scripting

A entry form

Want to make a entry for using shell script, something like this: Name:_____________ Age:____________ address:___________ This entry form showed on the screen when the script executed, ask the user enter the field one by one ( user press <Enter>, cursor will be on the next field), anyone... (5 Replies)
Discussion started by: trynew
5 Replies
Login or Register to Ask a Question