Need to extract specific info from text file
-
Hi I have a text file which has entries like the following:
new entry “MAG_CQCaster_ArcaneChargeAfterDash_Boots”
type “Armor”
using “_Foot_Magic”
data “RootTemplate” “400b3aca-fc9e-44c7-b5a7-a183693d3a75”
data “ValueUUID” “a229f048-70b0-4b0c-88cb-29b5c6bdb2d0”
data “Rarity” “Rare”
data “PassivesOnEquip” “MAG_CQCaster_ArcaneChargeAfterDash_Boots_Passive”
data “MinAmount” “1”
data “MaxAmount” “1”
data “Priority” “1”
data “Unique” “1”
data “MinLevel” “1”I want to extract only the NEW ENTRY data and the ROOTTEMPLATE data, and specifically the data itself.
So for example, for this entry I want:
MAG_CQCaster_ArcaneChargeAfterDash_Boots
400b3aca-fc9e-44c7-b5a7-a183693d3a75Is there a way to extract only this data from each entry, automatically?
Bear in mind I am not a coder so I would need pretty basic instructions.
Would really appreciate any help.
-
@yosharian
If the data you want is on 1 line you can use theFindMark option, ticking the option called bookmark.The online manual here has the reference for this. You would run it with the different text you want to look for. For each run the line would have a bookmark symbol created in the left margin.
After bookmarking, you can copy those bookmarked lines to another tab.
Terry
-
@Terry-R I’m sorry I don’t understand…
-
-
Something like this might work:
After running the Mark All you can use Copy Marked Text to put the resulting text somewhere else.
Find what expression as text:
^(new entry|data “RootTemplate”) “\K.+?(?=”)
You didn’t follow posting rules so maybe you don’t have smart double quotes, in which case the needed Find what expression as text is possibly:
^(new entry|data "RootTemplate") "\K.+?(?=")
If you’re curious about the posting rules, see HERE.
-
@yosharian Can you add a sample with both data you want and data you don’t? It is possible to write regexps to
- Delete unwanted data
- Transform remaining useful data
-
@yosharian For example, assuming you use Windows line endings (\r\n) and use double quotes instead of smart quotes this regexp
new entry.*"(.*)"\r\n(?:(?:(?:type.*)|(?:using.*))\r\n)*(?:(?:data.*RootTemplate.* "(.*)"\r\n)|(?:data.*\r\n))*
extracts data you need with “Find and replace” tool.
-
@Alexander-Verbitsky said in Need to extract specific info from text file:
new entry."(.)“\r\n(?:(?:(?:type.)|(?:using.))\r\n)(?:(?:data.RootTemplate. "(.)”\r\n)|(?:data.\r\n))
Why are you providing this much-more-complicated solution, when a simpler solution has been given above?
And…OP hasn’t poo-poo’d the earlier solution…
And…OP hasn’t answered your previous question yet… -
@Alan-Kilborn My solution transforms text as OP wants. OK, I don’t know, maybe marking text suits his need.
-
@Alexander-Verbitsky said in Need to extract specific info from text file:
My solution transforms text as OP wants. OK, I don’t know, maybe marking text suits his need.
All OP said was “extract”, not “transform”.