deleting text between ; and :


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting deleting text between ; and :
# 1  
Old 11-27-2008
deleting text between ; and :

An ldif export needs some text removed from every line with a ; and :

Only the text (including the ;) from the ; to the : (but not the :) needs to be removed.

thoughts?

here's an example of one record:

dn: cn=me,ou=groups,dc=me,dc=com
nsUniqueId: 1255060a-46e511dd-803ce5f5-385faa0b
objectClass;vucsn-4869456e0009002d0000: top
objectClass;vucsn-4869456e0009002d0000: groupOfUniqueNames
cn;vucsn-4869456e0009002d0000;mdcsn-4869456e0009002d0000: everyone
description;vucsn-4869456e0009002d0000: everyone

Thanks.
# 2  
Old 11-27-2008
Quote:
Originally Posted by rfransix
An ldif export needs some text removed from every line with a ; and :

Only the text (including the Smilie from the ; to the : (but not the Smilie needs to be removed.

thoughts?

here's an example of one record:

dn: cn=me,ou=groups,dc=me,dc=com
nsUniqueId: 1255060a-46e511dd-803ce5f5-385faa0b
objectClass;vucsn-4869456e0009002d0000: top
objectClass;vucsn-4869456e0009002d0000: groupOfUniqueNames
cn;vucsn-4869456e0009002d0000;mdcsn-4869456e0009002d0000: everyone
description;vucsn-4869456e0009002d0000: everyone

Thanks.
Code:
sed -e "s/;[^:]*:/:/g" input.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Deleting unwanted text from a table

Hi everyone, I have a microbial diversity table in the format ;k__kingdom; p__phylum, etc, somer rows have descriptions before the :k__ (like the af028349.1 below) is there a way I can get rid of this text (which is different every time) and keep all the other columns? Thanks a bunch! ;... (1 Reply)
Discussion started by: Juan Gonzalez
1 Replies

2. UNIX for Dummies Questions & Answers

Help with deleting some parts from text file

Hi all, I have a fat file which contains something like this: ************************************************ blahblahblah blahblahblah Myobject1 HOME ( homecontents01 ( some junk; ) home contents02( some junk; ) ... (7 Replies)
Discussion started by: newboy
7 Replies

3. UNIX for Dummies Questions & Answers

Deleting Block of Text from a File

Hi I am looking for the way to delete the block of data for example original file line1 line2 line3 line4 line5 input file line2 line3 original file should contain line1 line4 line5 (3 Replies)
Discussion started by: rakeshkumar
3 Replies

4. UNIX for Dummies Questions & Answers

Help with deleting characters from text file

I have a text file that looks like this: I want to delete the last character of first column in all rows so that my output looks like this: Thanks a lot! (1 Reply)
Discussion started by: evelibertine
1 Replies

5. UNIX for Dummies Questions & Answers

deleting text with sed

Hi There! I've got a tab delimited text file (output from a software) to which I would like to delete specific strings from one of the columns. I have tried several sed codes, but they do not seem to work for me. I can manage to delete a specific word, but this is of no use, as I what I want to... (3 Replies)
Discussion started by: alfredman
3 Replies

6. Shell Programming and Scripting

help with finding text and deleting line

HI All, I need to search for a particular pattern input by the user in order to delete the line. My username.txt has username@email.com:John:149.0.3.4:1 username1@email.com:Harry:149.0.3.4:1 username1@email.net:Alex:149.0.3.4:1 username1@email.edu:Nemo:149.0.3.4:1 The program i written ... (3 Replies)
Discussion started by: ichar
3 Replies

7. Shell Programming and Scripting

deleting text between two stings

example.txt ---------- this is a line i want to keep this is another line I wish to keep I wish to delete from here ON until I see four new lines from here and then I wish to keep the rest. These are some special charcters {)#@ which have to be deleted too This is a one more new line... (4 Replies)
Discussion started by: jville
4 Replies

8. UNIX for Dummies Questions & Answers

Deleting lines in text file

Hi everyone, I have text files that I want to delete lines from. I have searched through this forum for quite some time and found examples of both awk and sed. Unfortunately, I was not able to successfully do what I want. Well to some extent. I did manage to delete the first 15 lines from each... (5 Replies)
Discussion started by: hern14
5 Replies

9. Shell Programming and Scripting

Deleting text block in file

Need to delete a text block inside a file, that is marked with a start and an end pattern. Eg do not delete not delete <tag1> delete everything here here and here and here... <tag2> do not delete do not delete.... Believe sed is able to do this job but don't get it working. ... (1 Reply)
Discussion started by: andre123
1 Replies

10. Shell Programming and Scripting

Deleting text from a file

Hi, In my korn shell script, I want to delete some particular text from a certain file...How can this be done? Is the below right? ed $NAMES << EOF echo "" > /dev/null echo "${x} = " > /dev/null echo "name = " > /dev/null echo "adress = " > /dev/null w q EOF (1 Reply)
Discussion started by: n8575
1 Replies
Login or Register to Ask a Question