Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

FInd and Replace option!


  • Please log in to reply
28 replies to this topic

#1 andrenalina

andrenalina

  • Members
  • 9 posts
  • OFFLINE
  •  

Posted 12 December 2015 - 01:21 AM

Hello guys, I'm new here and I want to ask you if you could help me. I have a text where there is some times a number apears n the form [*], where the asterisk is some number. I would like to replace all these forms by <a href="../Text/0001.xhtml#R*">[*]</a> (the number appears twice),for all the possibilities where a number apear in that form. I did it in Word, but it was not possible to replace, the Word just pasted [*], with the asterisk in the place of the number (the program was able to find the form, but not replace it). I could do it manually but I would spend a lot of time.

Thanx anyone!


Edited by Orange Blossom, 12 December 2015 - 02:05 AM.
Moved to more appropriate forum. ~ OB


BC AdBot (Login to Remove)

 


#2 Havachat

Havachat

  • Members
  • 1,044 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Sleepy Hollow - Geelong - Go Cats.
  • Local time:06:17 AM

Posted 12 December 2015 - 01:47 AM

I use Bulk Rename Utility - This may assist you.

 

http://www.bulkrenameutility.co.uk/Screenshots.php

 

Slight learn curve - read help files etc.



#3 andrenalina

andrenalina
  • Topic Starter

  • Members
  • 9 posts
  • OFFLINE
  •  

Posted 12 December 2015 - 02:05 AM

I downloaded this program and it seems to be a program that renames files, not a program to find and replace structures in a text (like *.txt, *.html files), as I said. But that's the spirit, but for texts!



#4 technonymous

technonymous

  • Members
  • 2,480 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:17 PM

Posted 12 December 2015 - 02:26 AM

Ok I had to make a notepad to check if this works...

 

I created a notepad and put..

0001
0002
0003
0004
0005

Now you want to replace txt with some other txt. Place the cursor at the top line. For notepad you Press CTRL+H to activate the find and replace.

 

Now lets say I want to find all 000 and replace it with *. Enter in 000 in find and in the replace field type * and hit replace all button.

 

Now all 000's have been replaced with *. We can also replace all astrisks with null space. Place * in the find and in the replace field you put nothing. That's right, just leave it blank!

 

All Astrisks are now blank and The lines are now numbered 12345 etc.. To remove all numbers just type find 1 and replace all with nothing. Do this for each of the numeric numbers 1-9.

 

If you have tab or spaces you can also null those out as well. In the find field hit tab button. Then in the replace field leave it blank. Then press replace all.

 

If you have a lot of blank 4 spaces you can replace those as well. Just type 4 blank spaces and in the replace field you leave it blank.

 

There you go. Hope that helps you out!

 

Edit: Replacing something with nothing doesn't leave a blank space it actually just removes it.


Edited by technonymous, 12 December 2015 - 02:37 AM.


#5 andrenalina

andrenalina
  • Topic Starter

  • Members
  • 9 posts
  • OFFLINE
  •  

Posted 12 December 2015 - 02:34 AM

technonymous, imagine I want to replace the numbers 01, 02, 03, 04 and 05 from the text you wrote (I also wrote the number 0 to select a pattern) by, for example, a1, a2, a3, a4 and a5, than your text would become

 

00a1
00a2
00a3
00a4
00a5

That's I want to do! I would like to do it automatically, as I said, to do it manually I would have to spent a lot of time. Imagine a text with a lot of reference in the form [1], [2], [3], so on, some repeated, not all in order! I would like to replace the form "[*]" by something like "something+*+something_else+*+something_more", with the asterisk representing the number of the reference.

 


Edited by andrenalina, 12 December 2015 - 02:38 AM.


#6 technonymous

technonymous

  • Members
  • 2,480 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:17 PM

Posted 12 December 2015 - 02:41 AM

Ok lets say you want to remove all 00 you put in the find field 00 and in the replace field you put nothing leave it blank. Then press the replace all button. All those lines would become...

 

a1

a2

a3

a4

a5



#7 technonymous

technonymous

  • Members
  • 2,480 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:17 PM

Posted 12 December 2015 - 02:47 AM

Lets say you don't want any numbers, but you need to use the 00 as a search pattern. Search for 001 and replace with ** and hit the replace all. Do same for 002 003 004 etc. You still have to do some repetitive search, but not as much. When done your final search for all Astrisk ** and replace it with blank. Then you effectively removed all numbers 001, 002, 003 etc.



#8 andrenalina

andrenalina
  • Topic Starter

  • Members
  • 9 posts
  • OFFLINE
  •  

Posted 12 December 2015 - 02:48 AM

Here the problem, I want to replace all the citations in a text like this


 

Facebook is an online social networking service headquartered in Menlo Park, California. Its website was launched on February 4, 2004, by Mark Zuckerberg with his Harvard College roommates and fellow students Eduardo Saverin, Andrew McCollum, Dustin Moskovitz and Chris Hughes.[8][9][10]

To obtain this result.

Facebook is an online social networking service headquartered in Menlo Park, California. Its website was launched on February 4, 2004, by Mark Zuckerberg with his Harvard College roommates and fellow students Eduardo Saverin, Andrew McCollum, Dustin Moskovitz and Chris Hughes.<a href="../Text/0001.xhtml#R8">[8]</a> <a href="../Text/0001.xhtml#R9">[9]</a> <a href="../Text/0001.xhtml#R10">[10]</a>

That is, I want to link all references!


Edited by andrenalina, 12 December 2015 - 02:50 AM.


#9 technonymous

technonymous

  • Members
  • 2,480 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:17 PM

Posted 12 December 2015 - 02:51 AM

The key to making it work better, is inserting, finding a searching for the most common patterns. Then, Insert your own pattern it can be &&& or *&* or &*& etc. It then becomes more powerful to finaly search for that specific pattern and null it out.


Edited by technonymous, 12 December 2015 - 02:51 AM.


#10 technonymous

technonymous

  • Members
  • 2,480 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:17 PM

Posted 12 December 2015 - 02:54 AM

Ok then that is to complex for just find and replace. You would have to get into some customized powershell scripting or something to do that.


Edited by technonymous, 12 December 2015 - 02:57 AM.


#11 technonymous

technonymous

  • Members
  • 2,480 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:17 PM

Posted 12 December 2015 - 03:03 AM

Is this a document that is from off the web? It is possible to download entire websites and their content, referenced links should all be intact the same as you view it on the net, but it all loads locally.



#12 andrenalina

andrenalina
  • Topic Starter

  • Members
  • 9 posts
  • OFFLINE
  •  

Posted 12 December 2015 - 03:18 AM

Is it possible to do it with a Fortran code? A program to read a *.txt file and edit it?

Edit: I said Fortran because at the moment it is the best I can program.


Edited by andrenalina, 12 December 2015 - 03:20 AM.


#13 technonymous

technonymous

  • Members
  • 2,480 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:17 PM

Posted 12 December 2015 - 03:27 AM

I doubt it. :)



#14 andrenalina

andrenalina
  • Topic Starter

  • Members
  • 9 posts
  • OFFLINE
  •  

Posted 12 December 2015 - 10:27 AM

I doubt it. :)

Is that a challange?



#15 britechguy

britechguy

    Been there, done that, got the T-shirt


  • Moderator
  • 7,471 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Staunton, VA
  • Local time:04:17 PM

Posted 12 December 2015 - 03:53 PM

adrenalina,

 

           This is an absolute cinch to do in MS-Word if you know how to use wildcards for both find and replace.  See the article, Replace text using wildcards, for the full scoop.  This applies in any MS-Office program that has a find and replace function.

 

Your find string will be:  \[([0-9])\]
 
And your replace string will be:  <a href="../Text/0001.xhtml#R\1">[\1]</a>
 
Here are screen shots of me doing exactly what you wish to do with MS-Word 2010:
 
 
 
 
 
 
 
Well, I have the screen shots but there's no way to directly include them here.  I have yet to find forums software that will directly post Google Drive images, thus the URLs to the images above.  Lets see if trying to embed the Find & Replace image works:
 
As I suspected, it doesn't, but if you click the links above you'll see what I did.

Brian AKA Bri the Tech Guy (website in my user profile) - Windows 10 Home, 64-Bit, Version 1803, Build 17134 

 

     In a modern society where everyone thinks their opinion deserves to be heard nothing annoys me more than individuals who mistake their personal preferences for fact.

         ~ Commenter TheCruyffGurn on the The Guardian website, 8/13/2014

 

              

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users