Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
Practical-Cryptdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zhaozhen
Practical-Cryptdb
Commits
b5cfe853
Commit
b5cfe853
authored
May 20, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add scripts
parent
f6d8e000
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
split_to_n.sh
scripts/split_to_n.sh
+32
-0
No files found.
scripts/split_to_n.sh
0 → 100755
View file @
b5cfe853
function
get_split
(){
b
=
$1
e
=
$2
f
=
$3
pname
=
$4
sed
-n
"
${
b
}
,
${
e
}
p"
$f
>
${
f
}
_
${
pname
}
}
if
[
$#
!=
2
]
;
then
echo
"should give the text name, and the num of splits"
exit
fi
base
=
0
filename
=
$1
total_line
=
`
cat
$filename
|
wc
-l
`
num_of_splits
=
$2
echo
total_line:
$total_line
step
=
$[
$total_line
/
$num_of_splits
]
echo
step:
$step
#get_split 1 5 text 1
cnt
=
1
for
((
;
$base
<
$total_line
;
))
;
do
echo
$[
$base
+ 1
]
,
$[
$base
+
$step
]
, cnt:
$cnt
get_split
$[
$base
+ 1
]
$[
$base
+
$step
]
$filename
$cnt
base
=
$[
$base
+
$step
]
cnt
=
$[
$cnt
+ 1
]
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment