Convert xml to xlsx vbscript - vbscript

I have a vbscript code, where I convert from xml to xlsx. However, when converting it duplicates the information and takes the order of the columns. How do I reverse or adjust? Because I'm not able to format correctly. If you use excel and open it by hand and convert to xlsx it is correct.
This is my vbs code:
Dim xlApp, xlWkb, SourceFolder, TargetFolder, file
Set xlApp = CreateObject ("excel.application")
Set fs = CreateObject ("Scripting.FileSystemObject")
Const ForWriting = 2
Const TristateTrue = -1
Const xlNormal = 51
SourceFolder = "C: \ Users \ Convex \ Documents \ MICHAEL \ XML"
TargetFolder = "C: \ Users \ Convex \ Documents \ MICHAEL \ XLS"
xlApp.Visible = false
for each file in fs.GetFolder (SourceFolder) .files
Set xlWkb = xlApp.Workbooks.Open (file)
BaseName = fs.getbasename (file)
FullTargetPath = TargetFolder & "\" & BaseName & ".xlsx"
xlWkb.SaveAs FullTargetPath, xlNormal
xlWkb.close
next
'Uncomment this line to delete the source file
'fs.DeleteFile ("C: \ xml-to-xls \ xml \ *. xml")
Set xlWkb = Nothing
Set xlApp = Nothing
Set fs = Nothing
This is the xml:
<? xml version = "1.0" encoding = "utf-8"?>
<Transaction>
<list>
<registers>
<matricula> 5 </matricula>
<name> ANGEL EDUARDO TRIGUEROS CISNEROS </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 9 </matricula>
<name> MARCO AURELIO CARNEIRO </name>
<cpf> 00000000000 </cpf>
</registrates>
<registers>
<matricula> 6 </matricula>
<name> ADRIELLE ROSA CAMARGO DE ANDRADE </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 3 </matricula>
<name> GUILHERME QUINTINO RIBEIRO </name>
<cpf> 0000000 </cpf>
</registrates>
<registers>
<matricula> 14 </matricula>
<name> TIAGO DA FONTE LEITE </name>
<cpf> 00000000 </cpf>
</registrates>
<registers>
<matricula> 2 </matricula>
<name> LUIZ ANTONIO SACCO </name>
<cpf> 00000000000 </cpf>
</registrates>
<registers>
<matricula> 10 </matricula>
<name> JULIANA PEREIRA DA CUNHA WALENKAMP </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 8 </matricula>
<name> MARCEL KEITI TOMA </name>
<cpf> 00000000000 </cpf>
</registrates>
<registers>
<matricula> 13 </matricula>
<name> CRISTIANE BONATES MACEDO DE AMO </name>
<cpf> 00000000000 </cpf>
</registrates>
<registers>
<matricula> 11 </matricula>
<name> LUIS ANTONIO PAIN JUNIOR </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 12 </matricula>
<name> FLAVIO DALE LUCHE </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 1 </matricula>
<name> BRUNO VIEIRA ROBERTI </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 4 </matricula>
<name> GUILHERME GAMEIRO DUARTE </name>
<cpf> 00000000 </cpf>
</registrates>
<registers>
<matricula> 7 </matricula>
<name> CARLA FERNANDA PASQUALI </name>
<cpf> 0000000 </cpf>
</registrates>
</list>
</Transaction>
This is my vbs code:
Dim xlApp, xlWkb, SourceFolder, TargetFolder, file
Set xlApp = CreateObject ("excel.application")
Set fs = CreateObject ("Scripting.FileSystemObject")
Const ForWriting = 2`enter code here`
Const TristateTrue = -1
Const xlNormal = 51
SourceFolder = "C: \ Users \ Convex \ Documents \ MICHAEL \ XML"
TargetFolder = "C: \ Users \ Convex \ Documents \ MICHAEL \ XLS"
xlApp.Visible = false
for each file in fs.GetFolder (SourceFolder) .files
Set xlWkb = xlApp.Workbooks.Open (file)
BaseName = fs.getbasename (file)
FullTargetPath = TargetFolder & "\" & BaseName & ".xlsx"
xlWkb.SaveAs FullTargetPath, xlNormal
xlWkb.close
next
'Uncomment this line to delete the source file
'fs.DeleteFile ("C: \ xml-to-xls \ xml \ *. xml")
Set xlWkb = Nothing
Set xlApp = Nothing
Set fs = Nothing
This is the xml:
<? xml version = "1.0" encoding = "utf-8"?>
<Transaction>
<list>
<registers>
<matricula> 5 </matricula>
<name> ANGEL EDUARDO TRIGUEROS CISNEROS </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 9 </matricula>
<name> MARCO AURELIO CARNEIRO </name>
<cpf> 00000000000 </cpf>
</registrates>
<registers>
<matricula> 6 </matricula>
<name> ADRIELLE ROSA CAMARGO DE ANDRADE </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 3 </matricula>
<name> GUILHERME QUINTINO RIBEIRO </name>
<cpf> 0000000 </cpf>
</registrates>
<registers>
<matricula> 14 </matricula>
<name> TIAGO DA FONTE LEITE </name>
<cpf> 00000000 </cpf>
</registrates>
<registers>
<matricula> 2 </matricula>
<name> LUIZ ANTONIO SACCO </name>
<cpf> 00000000000 </cpf>
</registrates>
<registers>
<matricula> 10 </matricula>
<name> JULIANA PEREIRA DA CUNHA WALENKAMP </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 8 </matricula>
<name> MARCEL KEITI TOMA </name>
<cpf> 00000000000 </cpf>
</registrates>
<registers>
<matricula> 13 </matricula>
<name> CRISTIANE BONATES MACEDO DE AMO </name>
<cpf> 00000000000 </cpf>
</registrates>
<registers>
<matricula> 11 </matricula>
<name> LUIS ANTONIO PAIN JUNIOR </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 12 </matricula>
<name> FLAVIO DALE LUCHE </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 1 </matricula>
<name> BRUNO VIEIRA ROBERTI </name>
<cpf> 000000000 </cpf>
</registrates>
<registers>
<matricula> 4 </matricula>
<name> GUILHERME GAMEIRO DUARTE </name>
<cpf> 00000000 </cpf>
</registrates>
<registers>
<matricula> 7 </matricula>
<name> CARLA FERNANDA PASQUALI </name>
<cpf> 0000000 </cpf>
</registrates>
</list>
</Transaction>

Related

How do I sort 2 columns in shell script?

I have data like this:
Jul29 16:52
Jul30 19:06
Jul31 17:04
Aug1 17:22
Aug2 18:53
Aug3 21:44
Aug4 22:56
Aug6 17:01
Aug8 02:19
Aug8 16:49
Aug9 16:37
Aug10 21:09
Aug12 05:24
Aug12 17:09
Aug14 16:39
Aug16 16:41
Aug4 22:56
Aug6 17:01
Aug8 02:19
Aug8 16:49
Aug9 16:37
Aug10 21:09
Aug12 05:24
Aug12 17:09
Aug14 16:39
Aug16 16:41
Aug4 22:56
Aug6 17:01
Aug8 02:19
Aug8 16:49
Aug9 16:37
Aug10 21:09
Aug16 20:24
Aug16 19:09
Aug16 18:39
Aug16 16:41
I want to take out the duplicates, sort by the first column, then maintain that order and sort by the second column. Like the following:
Jul01 11:00
Aug01 12:00
Aug02 12:40
Aug03 10:00
Aug03 11:00
Aug03 13:00
I have this code:
cat filename | awk '!a[$0]++'
This only sorts the first column and something random happens to the second column. Any ideas?
When I tried cat ming | sort -k1M -k1d -k2V, I get this:
Jul29 16:52
Jul30 19:06
Jul31 17:04
Aug10 21:09
Aug10 21:09
Aug10 21:09
Aug1 17:22
Aug12 05:24
Aug12 05:24
Aug12 17:09
Aug12 17:09
Aug14 16:39
Aug14 16:39
Aug16 16:41
Aug16 16:41
Aug16 16:41
Aug16 18:39
Aug16 19:09
Aug16 20:24
Aug2 18:53
Aug3 21:44
Aug4 22:56
Aug4 22:56
Aug4 22:56
Aug6 17:01
Aug6 17:01
Aug6 17:01
Aug8 02:19
Aug8 02:19
Aug8 02:19
Aug8 16:49
Aug8 16:49
Aug8 16:49
Aug9 16:37
Aug9 16:37
Aug9 16:37
sort -u -k1.1,1.3M -k1.4n -k2V filename
-u
delete duplicate lines
-k1.1,1.3M
sort each line from word 1, character 1 to word 1, character 3 in month mode
-k1.4n
sort each line from word 1, character 4 until end of word 1 by numeric value
-k2V
sort second word in "version number" mode, which works well for the timestamp
you can use the following:
sort -k1M -k1.4n -k2V abcss | uniq
explanation:
k1M : does a month sort on the 1st column
k1.4n : does an numeric sort to get the columns in order
k2V : does a version sort on the second column to get timestamp right
The output will be:
Jul29 16:52
Jul30 19:06
Jul31 17:04
Aug1 17:22
Aug2 18:53
Aug3 21:44
Aug4 22:56
Aug6 17:01
Aug8 02:19
Aug8 16:49
Aug9 16:37
Aug10 21:09
Aug12 05:24
Aug12 17:09
Aug14 16:39
Aug16 16:41
Aug16 18:39
Aug16 19:09
Aug16 20:24

How can I get a maven assembly to omit all directories in the archive?

Results I am after: I want a zip file without any directories in it. Files only.
My plugin entry:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptor>src/assembly/descriptor.xml</descriptor>
<appendAssemblyId>false</appendAssemblyId>
<finalName>${artifactId}-${pom.version}</finalName>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
My descriptor:
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd
http://maven.apache.org/ASSEMBLY/2.0.0
http://maven.apache.org/ASSEMBLY/2.0.0 ">
<id>distribution</id>
<formats>
<format>zip</format>
</formats>
<!--<baseDirectory>target</baseDirectory>-->
<!--<includeBaseDirectory>true</includeBaseDirectory>-->
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<outputDirectory>./</outputDirectory>
<includes>
<include>src/**/*</include>
</includes>
<excludes>
<exclude>**/assembly/**</exclude>
<exclude>**/*.iml</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
...which results in a zip file:
user#host /cygdrive/c/Ws/someproject : zv subproject/target/somezip-SNAPSHOT.zip
Archive: subproject/target/somezip-SNAPSHOT.zip
Length Date Time Name
--------- ---------- ----- ----
0 01-11-2018 09:03 src/
0 01-05-2018 09:01 src/main/
0 01-09-2018 11:34 src/main/resources/
1158 01-09-2018 11:34 src/main/resources/SomeFile_0_0_0.xml
1836 01-09-2018 11:34 src/main/resources/AnotherFile_0_0_0.xml
11636 01-09-2018 11:34 src/main/resources/SomeFile1_0_0_0.xml
1171 01-09-2018 11:34 src/main/resources/SomeFile1_0_0_1.xml
1398 01-09-2018 11:34 src/main/resources/SomeFile1_0_0_1.xml
1006 01-09-2018 11:34 src/main/resources/SomeFile1_0_1_0.xml
6691 01-09-2018 11:34 src/main/resources/SomeFile1_1_0_0.xml
1641 01-09-2018 11:34 src/main/resources/SomeFile1_1_0_1.xml
1937 01-09-2018 11:34 src/main/resources/SomeFile1_1_0_0.xml
3181 01-09-2018 11:34 src/main/resources/SomeFile3_0_0_0.xml
1774 01-09-2018 11:34 src/main/resources/SomeFile3_1_0_0.xml
1185 01-09-2018 11:34 src/main/resources/SomeFile3_1_0_0.xml
14609 01-09-2018 11:34 src/main/resources/SomeFile3_3_0_0.xml
35711 01-09-2018 11:34 src/main/resources/SomeFile4_0_0_0.xml
15805 01-09-2018 11:34 src/main/resources/SomeFile5_0_0_0.xml
3491 01-09-2018 11:34 src/main/resources/SomeFile5_1_0_0.xml
18757 01-09-2018 11:34 src/main/resources/SomeFile_0_0_0.xml
1571 01-09-2018 11:34 src/main/resources/SomeFile_0_1_0.xml
1063 01-09-2018 11:34 src/main/resources/SomeFile_0_1_1.xml
1631 01-09-2018 11:34 src/main/resources/Wiggity.txt
--------- -------
140357 13 files

sort the numbers in multiple lines in vim

I have a file formatted as such:
...
[ strNADPplus ]
3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457
3458 3459 3460 3461 3462 3463 3464 11153 11154 11155 11156 11157 11158 11159 11160
5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269
5270 5271 5272 5273 5274 5275 5276 5277 12964 12965 12966 12967 12968 12969 12970
5360 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070
5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375
5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414
5415 5416 5417 5418 5419 5420 5421 13110 13111 13112 13113 13114 13115 13116 13117
5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478
5479 5480 5481 5482 5483 5484 5485 5486 13173 13174 13175 13176 13177 13178 13179
5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 13557 13558 13559 13560
5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 13683 13684 13685 13686
6021 6022 6023 6024 6025 6026 6027 6028 6029 13718 13719 13720 13721 13722 13723
6339 6340 6341 6342 6343 6344 6345 6346 6347 14044 14045 14046 14047 14048 14049
...
I want to sort the numbers in that block of lines to have something that looks like:
1 2 3 4
7 8 9 100
101 121 345
346 348 10232
16654 ...
I first tried with :4707,4743%sort n (4707 and 4743 are the lines of that block), but I was only able to sort the first values of each line.
I then tried to join the selection and sort the line: visual mode + J and :'<,'>sort n.
But it doesn't sort correctly.
3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 11153 11154 11155 11156 11157 11158 11159 11160 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 12964 12965 12966 12967 12968 12969 12970 5360 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 13110 13111 13112 13113 13114 13115 13116 13117 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 13173 13174 13175 13176 13177 13178 13179 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 13557 13558 13559 13560 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 13683 13684 13685 13686 6021 6022 6023 6024 6025 6026 6027 6028 6029 13718 13719 13720 13721 13722 13723 6339 6340 6341 6342 6343 6344 6345 6346 6347 14044 14045 14046 14047 14048 14049 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 7502 7503 7504 7505 7506 7507 7508 7509 15208 15209 15210 15211 15212 15213 15214 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 15377 15378 15379 15380 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 5254 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 5463 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 6334 6335 6336 6337 6338 14050 14051 14052 14053 14054 14055 14056 14057 7414 7415 7416 7417 7418 7419 7420 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 7498 7499 7500 7501 15215 15216 15217 15218 15219 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397
How do I sort everything and keep that layout?
I would simply use standard external unix tools:
:'<,'>!tr ' ' '\n' | sort -n | tr '\n' ' ' | fold -w 15 -s
This wraps lines to 15 characters.
:'<,'>!tr ' ' '\n' | sort -n | paste -d' ' - - -
This wraps to 3 numbers per line.

not getting the latest against the uniq with awk

65 20150427 000000000
8 20120930 000000000
18 20130626 000000000
6 20140505 000000000
1 20150603 000000000
18 20140712 000000000
65 20150502 000000000
10 20150113 000000000
92 20140707 000001000
20 20130530 000000000
11 20141231 000000000
15 20140516 000000000
1 20150523 000000000
18 20130620 120014000
7 20140505 000000000
Above is the file. First col is the uniq id followed by date & time. Whenever i am running the below query am not getting the desired result...
awk '{a[$1]=$1}END{for(i in a) print i,a[i]}' file
it is showing the random date but i want the latest date to be displayed against each uniq with no repetition.
Please suggest a way forward.
You can use this awk instead:
awk '!a[$1] || $2>a[$1]{a[$1]=$2} END{for (i in a) print i, a[i]}' file
1 20150603
6 20140505
7 20140505
8 20120930
10 20150113
11 20141231
15 20140516
18 20140712
20 20130530
65 20150502
92 20140707
$ sort -rn datetime.txt | sort -n -u
1 20150603 000000000
6 20140505 000000000
7 20140505 000000000
8 20120930 000000000
10 20150113 000000000
11 20141231 000000000
15 20140516 000000000
18 20140712 000000000
20 20130530 000000000
65 20150502 000000000
92 20140707 000001000

X12 syntax highlighting for Notepad++?

I work with a few different X12 standard EDI transactions (270/271, 276/277.) I thought I'd check to see if anyone knew of an existing syntax highlighting profile for these for Notepad++ before I start to work on my own.
I ran into the same problem, and ended up creating my own based on schema I had for 4010 & 5010 270/271, 276/277/278 message types.
Copy the code below into a file called X12.xml or something, then use the user defined language import feature in Notepad++ to import that xml file.
User defined dialogue... button (lightning bolt button)
Import button
May have to restart NP++ after import, but afterwards the new language will appear in your Language drop down menu.
<NotepadPlus>
<UserLang name="X12" ext="">
<Settings>
<Global caseIgnored="no" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">000000</Keywords>
<Keywords name="Folder+"></Keywords>
<Keywords name="Folder-"></Keywords>
<Keywords name="Operators">* : ^ ~ +</Keywords>
<Keywords name="Comment"></Keywords>
<Keywords name="Words1">ISA GS ST SE GE IEA </Keywords>
<Keywords name="Words2">BPR TRN AAA NX ENT RMR NM1 DTM DTP DMG INS REF BHT HL EQ N3 N4 PER PRV HI MPI EB HSD MSG III AMT STC SVC PWK CR6 CR5 CR2 CR1 CL1 CRC HCR UM </Keywords>
<Keywords name="Words3">LS LE</Keywords>
<Keywords name="Words4"></Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
<WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
<WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
<WordsStyle name="KEYWORD1" styleID="5" fgColor="0000FF" bgColor="FFFFFF" fontStyle="1" />
<WordsStyle name="KEYWORD2" styleID="6" fgColor="800000" bgColor="FFFFFF" fontStyle="1" />
<WordsStyle name="KEYWORD3" styleID="7" fgColor="00FF00" bgColor="FFFFFF" fontStyle="1" />
<WordsStyle name="KEYWORD4" styleID="8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
<WordsStyle name="COMMENT" styleID="1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
<WordsStyle name="COMMENT LINE" styleID="2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
<WordsStyle name="NUMBER" styleID="4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
<WordsStyle name="OPERATOR" styleID="10" fgColor="FF00FF" bgColor="FFFFFF" fontStyle="0" />
<WordsStyle name="DELIMINER1" styleID="14" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
<WordsStyle name="DELIMINER2" styleID="15" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
<WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
</Styles>
</UserLang>
</NotepadPlus>
I really liked Phaxmohdem solution, so I added a bit more to it. I hope others continue to improve this. =)
<NotepadPlus>
<UserLang name="X12" ext="">
<Settings>
<Global caseIgnored="no" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">000000</Keywords>
<Keywords name="Folder+"></Keywords>
<Keywords name="Folder-"></Keywords>
<Keywords name="Operators">* : ^ ~ +</Keywords>
<Keywords name="Comment"></Keywords>
<Keywords name="Words1">ISA IEA GS GE ST SE</Keywords>
<Keywords name="Words2">AAA ACT ADX AK1 AK2 AK3 AK4 AK5 AK6 AK7 AK8 AK9 AMT AT1 AT2 AT3 AT4 AT5 AT6 AT7 AT8 AT9 AT8 AT9 B2 B2A BEG BGN BHT BPR CAS CL1 CLM CLP CN1 COB CR1 CR2 CL3 CL4 CR5 CR6 CRC CTX CUR DMG DN1 DN2 DSB DTM DTP EB EC ENT EQ FRM G61 G62 HCP HCR HD HI HL HLH HSD ICM IDC III IK3 IK4 IK5 INS IT1 K1 K2 K3 L3 L11 LIN LQ LUI LX MEA MIA MOA MPI MSG N1 N2 N3 N4 NM1 NTE NX OI PAT PER PLA PLB PO1 PRV PS1 PWK QTY RDM REF RMR S5 SAC SBR SLN STC SV1 SV2 SV3 SV4 SV5 SVC SVD TA1 TOO TRN TS2 TS3 UM</Keywords>
<Keywords name="Words3">LS LE</Keywords>
<Keywords name="Words4">00 000 0007 001 0010 0019 002 0022 003 004 00401 004010 004010X061 004010X061A1 004010X091 004010X091A1 004010X092 004010X092A1 004010X093 004010X093A1 004010X094 004010X094A1 004010X095 004010X095A1 004010X096 004010X096A1 004010X098 004010X098A1 005 00501 005010 005010X212 005010X217 005010X218 005010X220 005010X220A1 005010X221 005010X221A1 005010X222 005010X222A1 005010X223 005010X223A1 005010X223A2 005010X224 005010X224A1 005010X224A2 005010X230 005010X231 005010X279 005010X279A1 006 007 0078 008 009 01 010 011 012 013 014 015 016 017 018 019 02 020 021 022 023 024 025 026 027 028 029 03 030 031 032 035 036 04 05 050 06 07 08 09 090 091 096 097 0B 0F 0K 102 119 139 150 151 152 18 193 194 196 198 1A 1B 1C 1D 1E 1G 1H 1I 1J 1K 1L 1O 1P 1Q 1R 1S 1T 1U 1V 1W 1X 1Y 1Z 200 232 233 270 271 276 277 278 286 290 291 292 295 296 297 2A 2B 2C 2D 2E 2F 2I 2J 2K 2L 2P 2Q 2S 2U 2Z 30 300 301 303 304 307 31 314 318 330 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 356 357 36 360 361 374 382 383 385 386 388 393 394 3A 3C 3D 3E 3F 3G 3H 3I 3J 3K 3L 3M 3N 3O 3P 3Q 3R 3S 3T 3U 3V 3W 3X 3Y 3Z 40 405 41 417 431 434 435 438 439 441 442 444 446 45 452 453 454 455 456 458 46 461 463 471 472 473 474 480 481 484 492 4A 4B 4C 4D 4E 4F 4G 4H 4I 4J 4K 4L 4M 4N 4O 4P 4Q 4R 4S 4U 4V 4W 4X 4Y 4Z 539 540 543 573 580 581 582 598 5A 5B 5C 5D 5E 5F 5G 5H 5I 5J 5K 5L 5M 5N 5O 5P 5Q 5R 5S 5T 5U 5V 5W 5X 5Y 5Z 607 636 695 6A 6B 6C 6D 6E 6F 6G 6H 6I 6J 6K 6L 6M 6N 6O 6P 6Q 6R 6S 6U 6V 6W 6X 6Y 70 71 72 738 739 74 77 771 7C 82 820 831 834 835 837 85 850 866 87 8H 8U 8W 938 997 999 9A 9B 9C 9D 9E 9F 9H 9J 9K 9V 9X A0 A1 A172 A2 A3 A4 A5 A6 A7 A8 A9 AA AAE AAG AAH AAJ AB ABB ABC ABF ABJ ABK ABN AC ACH AD ADD ADM AE AF AG AH AI AJ AK AL ALC ALG ALS AM AN AO AP APC APR AQ AR AS AT AU AV AX AY AZ B1 B2 B3 B4 B6 B680 B7 B9 BA BB BBQ BBR BC BD BE BF BG BH BI BJ BK BL BLT BM BN BO BOP BP BPD BQ BR BS BT BTD BU BV BW BX BY BZ C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CAD CB CC CCP CD CE CER CF CG CH CHD CHK CI CJ CK CL CLI CLM01 CM CN CNJ CO CON CP CQ CR CS CT CV CW CX CY CZ D2 D3 D8 D9 D940 DA DB DCP DD DEN DEP DG DGN DH DI DJ DK DM DME DN DO DP DQ DR DS DT DX DY E1 E1D E2 E2D E3 E3D E5D E6D E7 E7D E8 E8D E9 E9D EA EAF EBA ECH ED EI EJ EL EM EMP EN ENT01 EO EP EPO ER ES ESP ET EV EW EX EXS EY F1 F2 F3 F4 F5 F6 F8 FA FAC FAM FB FC FD FE FF FH FI FJ FK FL FM FO FS FT FWT FX FY G0 G1 G2 G3 G4 G5 G740 G8 G9 GB GD GF GH GI GJ GK GM GN GO GP GR GW GT GY H1 H6 HC HE HF HH HJ HLT HM HMO HN HO HP HPI HR HS HT I10 I11 I12 I13 I3 I4 I5 I6 I7 I8 I9 IA IAT IC ID IE IF IG IH II IJ IK IL IN IND IP IR IS IV J1 J3 J6 JD JP KG KH KW L1 L2 L3 L4 L5 L6 LA LB LC LD LI LM LOI LR LT LU LTC LTD M1 M2 M3 M4 M5 M6 M7 M8 MA MB MC MD ME MED MH MI MJ ML MM MN MO MOD MP MR MRC MS MSC MT N5 N6 N7 N8 NA ND NE NF NH NI NM109 NL NN NON NQ NR NS NT NTR NU OA OB OC OD ODT OE OF OG OL ON OP OR OT OU OX OZ P0 P1 P2 P3 P4 P5 P6 P7 PA PB PC PD PDG PE PI PID PL PN PO POS PP PPO PQ PR PRA PRP PS PT PU PV PW PXC PY PZ Q4 QA QB QC QD QE QH QK QL QM QN QO QQ QR QS QV QY R1 R2 R3 R4 RA RB RC RD8 RE REC RET RF RGA RHB RLH RM RN RNH RP RR RT RU RW RX S1 S2 S3 S4 S5 S6 S7 S8 S9 SA SB SC SD SEP SET SFM SG SJ SK SL SP SPC SPO SPT SS STD SU SV SWT SX SY SZ T1 T10 T11 T12 T2 T3 T4 T5 T6 T7 T8 T9 TC TD TE TF TJ TL TM TN TNJ TO TPO TQ TR TRN02 TS TT TTP TU TV TWO TZ UC UH UI UK UN UP UPI UR UT V1 V5 VA VER VIS VN VO VS VV VY W1 WA WC WK WO WP WR WU WW X12 X3 X4 X5 X9 XM XN XP XT XV XX XX1 XX2 XZ Y2 Y4 YR YT YY Z6 ZB ZH ZK ZL ZM ZN ZO ZV ZX ZZ</Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="KEYWORD1" styleID="5" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" />
<WordsStyle name="KEYWORD2" styleID="6" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="1" />
<WordsStyle name="KEYWORD3" styleID="7" fgColor="00FF00" bgColor="FFFFFF" fontName="" fontStyle="1" />
<WordsStyle name="KEYWORD4" styleID="8" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="COMMENT" styleID="1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="COMMENT LINE" styleID="2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="NUMBER" styleID="4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="OPERATOR" styleID="10" fgColor="FF00FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="DELIMINER1" styleID="14" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="DELIMINER2" styleID="15" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
</Styles>
</UserLang>
</NotepadPlus>
Don't reinvent the wheel. Here's a free tool for you that I think you'll love:
http://liaison.com/products/integrate/edi/edi-notepad
It's called EDI Notepad. It has syntax validation, editing, HTML and Hex modes.
Notepad++ and UltraEdit are both great for looking at text files, but this tool does a better job with EDI.
If you are just looking to make segments easier to find a simple find/replace of the segment identifier plus a newline should help a lot.
Search: ~
Replace: ~\r\n
Depending on your newline setting of course.
Also if you are primarily working with internally generated X12's that follow a standard for identifiers then a user defined language would work.
It would be so great to create "EDIFACT/X12" plug-in(s) for Notepad++. For now, I am not aware of any existing ones.
Regarding EDI Notepad vs. Notepad++, the difference is crystal clear: one is a commercial product and the other is open source.

Resources