Quantcast
Channel: All Desktop Operating Systems and Recovery posts
Viewing all articles
Browse latest Browse all 92442

How can I replace some spaces with underscores in a text file?

$
0
0

I have genealogy software which stores my research in a text file known as a GEDCOM file. I'm now trying to prepare the contents of the file for publishing online on a website. The GEDCOM file includes references to picture files (pictures of my family and ancestors). The website that I want to use doesn't like filenames containing spaces. I therefore need to find a way of editing the GEDCOM text and replacing the spaces in the names of the picture files with, say, an underscore character. 

To be specific: 
Here's an example of a line of text that needs editing: 
1 _FILE Media\Pictures\20060611 Vicky Young.JPG 
and I would like it to end up like this: 
1 _FILE Media\Pictures\20060611_Vicky_Young.JPG 

The lines always start 1 _FILE Media\Pictures\ 
No other lines start with this text. 

The number of spaces per line will differ from filename to filename. I didn't use an particular file naming convention. 

It's important that the 2 spaces at the start of the line are not converted to underscores. 

Note that I already know how to the names of the actual files, so it's just the text in the GEDCOM that I need to know how to change. 

I am using Windows 7 64 bit. The GEDCOM file is a standard text file eg I can open and read it with Notepad. 

There are about 650 lines of text that need amending, in a much longer file, so if I can find a way of automating that would be great. If the solution involves buying some software, that's fine if not very expensive - this is a one-time job and probably won't be needed again. 


Viewing all articles
Browse latest Browse all 92442

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>