Text renaming?

hawke

Power Member
Joined
Nov 14, 2008
Messages
644
Reaction score
536
Let's say I have a list like this
Code:
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxx.xxxxx

And it needs to look like this
Code:
GrpList_0000=alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxx
GrpList_0001=alt.xxxxxxxx.xxxxxxx.xxxxxx.xxxxxxxx

They need to be in sequential order, is there an automated way of renaming these? As i have nearly 100,000 lines to do this for :(
 
Let's say I have a list like this
Code:
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxx.xxxxx
And it needs to look like this
Code:
GrpList_0000=alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxx
GrpList_0001=alt.xxxxxxxx.xxxxxxx.xxxxxx.xxxxxxxx
They need to be in sequential order, is there an automated way of renaming these? As i have nearly 100,000 lines to do this for :(

There might be a simpler way to do this, but this is the best way I would do it, and it won't take long.

Replace all "alt." with GrpList_" then open up excel and start with 0000 in a column, use the fill function to go numerically down until whatever you need (Ex. 1,472). Then you could either copy/paste the column or open up the whole thing in a .csv (placing commas in between by using replace all function again).

Sorry if this sounds confusing, I had to do quite a bit of this type of stuff when starting off some projects a year or so back.
 
Pm me and I'll make you a quick and small tool to do it... ;)
 
If you have access to a Unix/Linux shell, you can use the following awk command to give you your desired results:

Code:
awk 'BEGIN {OFS=""} {printf "%s%04d%s","GrpList_",""NR-1"","="$1"\n"}' filenamehere

The file "filenamehere" contains:
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxxxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxxxxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxx
alt.xxxxxxx.xxxxxxx.xxxxxx.xxx.xxxxx
 
Back
Top