Skip to content

Commit

Permalink
Added sample sed scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
SoptikHa2 committed Apr 21, 2020
1 parent ae563f9 commit 1cb80f7
Show file tree
Hide file tree
Showing 3 changed files with 410 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sed/graph-challenge.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
4
5
0 1 3
0 2 2
1 2 1
1 3 4
2 3 5
59 changes: 59 additions & 0 deletions sed/graph-problem.sed
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
x
z
x
:x
s/$/%;%90123456789/
:y
s/(.)%((%?.)*\1)|;.*/\3\2/
ty
/\n/bz
s/^0*//
N
:z
/\n0+$/!{
x
N
x
bx
}
s/(.*)\n.*/,\1;/
x
s/^\n//
s/(\n|$)/%&/g
s/(^|\n)/:/g
:a
/[0-9]%/{
s/ %/ 0%/g
s/^/0@1@2@3@4@5@6@7@8@9@#/
:b
s/([0-9])@([^#]*#.*)(:[^:]*)\1%([^:]*)/\1@\3%\1\4\2/
tb
s/.@|#//g
ba
}
s/%0*([0-9])/\1/g
/;/be
s/^/:0 0:,0;/
:c
:d
s/(,([0-9]*);.*:)(_?[0-9]* )?\2 ([^:]*)/\1_\2 \3\4/
td
/\n/bf
s/:_[0-9]* _[^:]*//g
s/(^[^;]*)(;[^_]*)(:_[0-9]* ([0-9]*)[^:]*)/\3\1,\4\2/
s/^:_([0-9]*) ([^:,]*)([^;]*)(:\1 [0-9]*)/:_\2%\4%\3/
ba
:e
/^:_/s/^(:_[0-9]* )[^:]*(:[0-9]* ([0-9]*))/\1\3\2/
s/:_(.*;)/:\1/
s/%//g
tc
s/_|,.*//g
x
G
bd
:f
s/.*:_[^ ] ([0-9]*).*/\1/
tg
s/.*//
:g
Loading

0 comments on commit 1cb80f7

Please sign in to comment.