deleting symbols and characters between two words


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting deleting symbols and characters between two words
# 1  
Old 02-12-2009
deleting symbols and characters between two words

Hi
Please tell me how could i delete symbols, whitespaces, characters, words everything between two words in a line. Let my file is
Code:
aaa BB ccc ddd eee FF kkk xxx
123456 BB 44^& iop FF 999
xxx uuu rrr BB hhh nnn FF 000

I want to delete everything comes in between BB and FF( deletion includes both the words too i.e. BB and FF) . so that the required output should be

Code:
aaa kkk xxx
123456 999
xxx uuu rrr 000


Last edited by rbatte1; 06-27-2016 at 05:41 AM.. Reason: Code tags
# 2  
Old 02-12-2009
Try this

Code:
sed -e "s/ BB.*FF//g" infile


Last edited by rbatte1; 06-27-2016 at 05:41 AM.. Reason: Code tags
# 3  
Old 02-12-2009
Code:
 sed  's/BB.*FF //' file

You should take a look at: I'm new to Unix. Which books should I read? - The UNIX and Linux Forums
And learn how to use [code] tags Smilie
# 4  
Old 02-12-2009
Hey thanx friends.. This works for me
Thanks a lott
Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting a list of words from a text file

Hello, I have a list of words separated by spaces I am trying to delete from a text file, and I could not figure out what is the best way to do this. what I tried (does not work) : delete="password key number verify" arr=($delete) for i in arr { sed "s/\<${arr}\>]*//g" in.txt } >... (5 Replies)
Discussion started by: Hawk4520
5 Replies

2. Shell Programming and Scripting

Using key words or symbols to determine parser

There are multiple conditions in which the user can input data. 1. > 2. del 3. ins 4. delins The user input is saved in a specific directory using the code below: Code: cd 'C:' C:/Users/cmccabe/Desktop/Python27/python.exe C:/Users/cmccabe/Desktop/Python27/run_batch_job.py... (12 Replies)
Discussion started by: cmccabe
12 Replies

3. UNIX for Dummies Questions & Answers

Deleting words between every appearance of two words

Hi there, newbie there. I've been browsing the forums hoping to find a solution that answers a problem similar to what I need, but haven't had much luck. Any help would be greatly appreciated. Thanks! I need to delete a bunch of text between every appearance of two words in a really large file... (3 Replies)
Discussion started by: lendl
3 Replies

4. Shell Programming and Scripting

removing the words with symbols in a file in unix

I have file like below Hi iam author <br>joseph</br> in france. I live in my home <br></br> but no food. I will play footbal <br></br> but i wont play cricket. I will read all the books <br>all fiction stories</br> i hate horror stories. I want output like below Hi iam author... (3 Replies)
Discussion started by: vinothsekark
3 Replies

5. UNIX for Dummies Questions & Answers

Deleting words and sorting

I have a file that looks some like this: I need to delete most of the information and sort the rest in such way that I get the following output file Any help will be greatly appreciated (3 Replies)
Discussion started by: Xterra
3 Replies

6. UNIX for Dummies Questions & Answers

deleting words in list with more than 2 identical adjacent characters

Morning Guys & Gals, I am trying to figure out a way to remove lines from a file that have more than 2 identical characters in sequence.. So if for instance the list would look like ; the output would be ; I can't seem to get my head around perl (among many other... (7 Replies)
Discussion started by: TAPE
7 Replies

7. Shell Programming and Scripting

Get characters between two words

Guys, Here is the txt file... SLIC N0SLU704034789 rŒ° EJ00 ó<NL DMRG>11 100 4B 2 SLIC N0SLU704034789 rŒ° TJ10 <4000><NL> 2 SLIC N0SLU704034789 ... (2 Replies)
Discussion started by: gowrishankar05
2 Replies

8. Shell Programming and Scripting

Replace words with the first characters

Hello folks, I have a simple request but I can't find a simple solution. Hare is my problem. I have some dates, I need to replace months with only the first 3 characters (jan for january, feb for february, ... all in lower case) ~$ echo '3 october 2010' | sed 3 oct 2010I thought of something... (8 Replies)
Discussion started by: tukuyomi
8 Replies

9. Shell Programming and Scripting

Deleting words between tags

Hi !!! I need to write a script(ksh) that deletes any character outside <start> tag and </start> from a file. For eg: $cat file.txt <start> ad bd </start> as</start> <start> d e f mb<start>mu g h i (7 Replies)
Discussion started by: PRKS
7 Replies

10. Shell Programming and Scripting

deleting blank line and row containing certain words in single sed command

Hi Is it possible to do the following in a single command /usr/xpg4/bin/sed -e '/rows selected/d' /aemu/CALLAUTO/callauto.txt > /aemu/CALLAUTO/callautonew.txt /usr/xpg4/bin/sed -e '/^$/d' /aemu/CALLAUTO/callautonew.txt > /aemu/CALLAUTO/callauto_new.txt exit (1 Reply)
Discussion started by: aemunathan
1 Replies
Login or Register to Ask a Question