Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Place dashes in GUIDs using replace all

Tags:

guid

notepad++

I've got a file with 200 or so GUID's scattered throughout that have had their dashes removed. I need to put these dashes back in but doing it manually would be tedious and time consuming. Is there a way to do a replace all, perhaps in notepad++, to place dashes in the GUIDS?

like image 703
N4villu5 Avatar asked Dec 19 '12 12:12

N4villu5


2 Answers

Press CTRL+H to open the "Replace"-Dialog:

Enter

  ([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})

in the "Find What"-Textfield and

$1-$2-$3-$4-$5

int the "Replace With"-Textfield. Make sure to have checked the "Regular Expression" checkbox.

Press the "Replace All" button and the magic will happen.

like image 178
Simon Avatar answered Oct 04 '22 18:10

Simon


With notepad++ do following :

At present you should see something like this in notepad++

1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e
1414527670f747218137fd1059046a4e

Create one column of 200 dashes and copy the column using Alt+ Mouse Selection (vertically).

Now you should be able to paste these 200 dashes wherever you like in above data. I did this in less than a minute for 20 records shown above. You will hardly take 10 mins ? Much more quicker than a regex ;), specially if you consider the efforts of programming and testing.

See my data for 20 records below :

14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e
14145276-70f7-4721-8137-fd1059046a4e

Hope I am clear. Read this for column select details in notepad++

like image 33
AYK Avatar answered Oct 04 '22 18:10

AYK