icersplicer 0.1.4 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/icersplicer +32 -12
- data/lib/icersplicer.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2beec4f35e822f4c6c37e651aa607cb1f5f8538
|
4
|
+
data.tar.gz: 90fa44bb5f71d6cb8f7fad991c000e740fa77131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75c499006d2fc912975ab8b6efb94e26070f61de04507838e671c5d4681d54b66f87c94a7238ce7c495906680266f3f8e2c031e0cbad6db18952389846e3e74d
|
7
|
+
data.tar.gz: 1cf7aa189a385d69717417f02d152d07392676f2b8260e8e41285c37ada82f14c39ada3af76780bb0400bceadadcdba07cdbc6ff3eeddf182b632ef43f4fc038
|
data/bin/icersplicer
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
#
|
4
4
|
# Author: Brian Hood
|
5
5
|
# Name: Icersplicer
|
6
|
+
# Email: brianh6854@googlemail.com
|
6
7
|
#
|
7
8
|
# Description:
|
8
|
-
#
|
9
|
-
#
|
9
|
+
# Tool for file manipulation similar to UNIX tools
|
10
|
+
# like cat / head / tail
|
10
11
|
#
|
11
12
|
# Why: for processing large datasets quickly.
|
12
13
|
########################################################################
|
@@ -19,6 +20,8 @@ require File.expand_path(File.join(
|
|
19
20
|
|
20
21
|
include Icersplicer
|
21
22
|
|
23
|
+
VERSION = Icersplicer::VERSION::STRING
|
24
|
+
|
22
25
|
ARGV[0] = "--help" if ARGV[0] == nil
|
23
26
|
|
24
27
|
opts = GetoptLong.new(
|
@@ -28,6 +31,7 @@ opts = GetoptLong.new(
|
|
28
31
|
[ '--incrementlimit', '-i', GetoptLong::OPTIONAL_ARGUMENT],
|
29
32
|
[ '--inputfile', '-f', GetoptLong::REQUIRED_ARGUMENT],
|
30
33
|
[ '--skiplines', '-s', GetoptLong::OPTIONAL_ARGUMENT],
|
34
|
+
[ '--skipblank', '-b', GetoptLong::NO_ARGUMENT ],
|
31
35
|
[ '--quiet', '-q', GetoptLong::OPTIONAL_ARGUMENT],
|
32
36
|
[ '--outputfile', '-o', GetoptLong::OPTIONAL_ARGUMENT],
|
33
37
|
[ '--countlines', '-c', GetoptLong::OPTIONAL_ARGUMENT]
|
@@ -36,16 +40,25 @@ opts = GetoptLong.new(
|
|
36
40
|
opts.each do |opt, arg|
|
37
41
|
case opt
|
38
42
|
when '--help'
|
39
|
-
helper = "\e[1;34mWelcome to Icersplicer\e[0m\ \n"
|
40
|
-
helper << "\e[1;34m
|
43
|
+
helper = "\e[1;34mWelcome to Icersplicer #{VERSION}\e[0m\ \n"
|
44
|
+
helper << "\e[1;34m============================\e[0m\ \n"
|
41
45
|
helper << %q[
|
42
|
-
-h, --help:
|
46
|
+
-h, --help '-h':
|
43
47
|
show help
|
44
|
-
|
48
|
+
--lineoffset '-l' INTEGER
|
49
|
+
--linelimit '-n' INTEGER
|
50
|
+
--inputfile '-f' filename
|
51
|
+
--skiplines '-s' LINE NUMBERS 3,5,6
|
52
|
+
--skipblank '-b' NO ARGUMENTS
|
53
|
+
--quiet '-q' NO ARGUMENTS
|
54
|
+
--outputfile '-o' filename
|
55
|
+
--countlines '-c' Counts the lines of a file
|
56
|
+
|
45
57
|
Example:
|
46
58
|
|
47
59
|
icersplicer -f inputfile --lineoffset 0 --linelimit 10 -s 3,6,9 -o outputfile
|
48
|
-
|
60
|
+
|
61
|
+
Written by Brian Hood
|
49
62
|
]
|
50
63
|
puts helper
|
51
64
|
exit
|
@@ -63,6 +76,9 @@ Example:
|
|
63
76
|
when '--skiplines'
|
64
77
|
@skip_lines = Array.new
|
65
78
|
arg.to_s.split(",").each {|n| @skip_lines << n.to_i }
|
79
|
+
when '--skipblank'
|
80
|
+
@skipblank = "SKIP"
|
81
|
+
puts @skipblank
|
66
82
|
when '--quiet'
|
67
83
|
if arg == "true"
|
68
84
|
@quiet_mode = true
|
@@ -114,16 +130,20 @@ File.open(inputfile) {|n|
|
|
114
130
|
unless lineoffset > increment_offset
|
115
131
|
unless linelimit == 0
|
116
132
|
unless increment_limit > linelimit
|
133
|
+
unless instance_variable_defined?("@skipblank") and data.strip == ""
|
134
|
+
print_to_screen(linecounter, text_highlighter(data), quietmode) unless skip(linecounter)
|
135
|
+
if instance_variable_defined?("@outputfile")
|
136
|
+
processdata(data_orig, outputfile, quietmode) unless skip(linecounter)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
else
|
141
|
+
unless instance_variable_defined?("@skipblank") and data.strip == ""
|
117
142
|
print_to_screen(linecounter, text_highlighter(data), quietmode) unless skip(linecounter)
|
118
143
|
if instance_variable_defined?("@outputfile")
|
119
144
|
processdata(data_orig, outputfile, quietmode) unless skip(linecounter)
|
120
145
|
end
|
121
146
|
end
|
122
|
-
else
|
123
|
-
print_to_screen(linecounter, text_highlighter(data), quietmode) unless skip(linecounter)
|
124
|
-
if instance_variable_defined?("@outputfile")
|
125
|
-
processdata(data_orig, outputfile, quietmode) unless skip(linecounter)
|
126
|
-
end
|
127
147
|
end
|
128
148
|
increment_limit += 1
|
129
149
|
end
|
data/lib/icersplicer.rb
CHANGED