Extract User names from Text File

mike2468

Registered Member
Joined
Nov 8, 2011
Messages
82
Reaction score
4
Is it possible to extract usernames from a text file and save in csv format or another text file? The text leading up to the file name is standard so there must be some way.

Example:"from":{"username":"USERNAMEHERE","profile_picture":"https:\/\/igc

I have pages and pages of this code so I'd like to avoid doing this by hand.
 
Last edited:
Easy...

If your file consistently contains the text in your example you can easily create a comma delimited file by using the find replace function in notepad++ or your favorite text editor. As long as the text to the left and right of the unique username is consistent the method below will work. Otherwise you can use some Regular Expression terms for the find/replace.. but start here.

Using your example:
Replace the text to the left of your target.

The exact text for the find function is within this bracket > ["from":{"username":"]
Replace that text with a comma ,

Run another find replace function to replace what is to the right of your target.
The exact text for the 2nd find function is within this bracket > [","profile _picture"]
Replace that text with a comma ,

At the end of these two find/replace functions you should end up with text that looks like:
,USERNAMEHERE,:"https:\/\/igcblahblah
,USERNAMEHERE,:"https:\/\/igcblahblah
,USERNAMEHERE,:"https:\/\/igcblahblah
,USERNAMEHERE,:"https:\/\/igcblahblah

Save as a .CSV file and open or import into Excel or Libre Office (Free spreadsheet) The Usernames will be all in one column.
 
stvmn- tried that, but the issue is that the text is not all the same before as it's from a web page. Just the same for about 15 characters before and 15 characters after.

Appreciate the help though.
 
Any ideas to solve this issue?
 
Still trying to fix this problem.
 
Code:
[COLOR=#FFFFCC]{"username":"USERNAMEHERE","profile _picture":"https:\/\/igc[/COLOR]


There are at least 3 different ways:


1. You could decode it with json.

2. You could scrap everything between
Code:
[COLOR=#FFFFCC]"username":"[/COLOR]
and
Code:
[COLOR=#FFFFCC]","[/COLOR]

3. You could use RegExp.


But you will need some programming experience.
 
Copy it all to notepad, and use Find & Replace(F&R) to put a blank line directly before the username. So F&R:
Code:
"username":"
with a blank space. That would turn
Code:
"from":{"username":"USERNAMEHERE","profile  _picture":"https:\/\/igc
into
Code:
"from":{ USERNAMEHERE","profile  _picture":"https:\/\/igc

Then at the end of it do this, F&R:
Code:
","profile
with @domain.com and a blank space, so your end result would give you this now:
Code:
"from":{ [email protected] _picture":"https:\/\/igc

Once you have this, just get any old regular email extractor, and extract all of the usernames, then replace the fake domain at the end with nothing to remove it and wa-la :) Hope it helps.
 
Copy it all to notepad, and use Find & Replace(F&R) to put a blank line directly before the username. So F&R:
Code:
"username":"
with a blank space. That would turn
Code:
"from":{"username":"USERNAMEHERE","profile  _picture":"https:\/\/igc
into
Code:
"from":{ USERNAMEHERE","profile  _picture":"https:\/\/igc

Then at the end of it do this, F&R:
Code:
","profile
with @domain.com and a blank space, so your end result would give you this now:
Code:
"from":{ [email protected] _picture":"https:\/\/igc

Once you have this, just get any old regular email extractor, and extract all of the usernames, then replace the fake domain at the end with nothing to remove it and wa-la :) Hope it helps.
very nice mate . . . . .
 
Back
Top