sepfile separates a target file by a keyword line.
Each separated file names are added a dot and a sequence number after the target file name.
When you have installed the Go, Please execute following go get
command:
go get -u github.com/qt-luigi/sepfile
$ sepfile
sepfile separates a target file by a keyword line.
Each separated file names are added a dot and a sequence number after the target file name.
Usage:
sepfile <srcfile> <kwdline> [<outpath>]
Each arguments are:
<srcfile>
a target file.
<kwdline>
a keyword line for separating.
if an error occurred then surround it by '"'.
[<outpath>]
an output file path.
default is ".".
Check to exist the target file.
$ ls
target.html
See the target file.
$ cat target.html
<html>
<head>
<title>sepfile test</title>
</head>
<body>
foo
<br>
bar
<br>
baz
</body>
</html>
When you separate the target.html by "<br>" line of between "foo" to "bar", Execute following sepfile
command:
$ sepfile target.html "<br>"
If you want to create the separating files in another directory, Please specify output path at the third argument.
$ sepfile target.html "<br>" ../
Create the separating files in current directory when argument length is two.
$ ls
target.html target.html.1 target.html.2
See the separating files.
$ cat target.html.1
<html>
<head>
<title>sepfile test</title>
</head>
<body>
a
$ cat target.html.2
b
<br>
c
</body>
</html>
You specified "<br>" line, not " <br>" line. A keyword line must equals completely.
MIT
Ryuji Iwata
This tool is mainly using by myself. :-)