icersplicer 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/icersplicer +59 -41
- data/lib/version.rb +1 -1
- 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: d19e22f059ad62dc8dd6c4f43be341eb14e5f3a3
|
4
|
+
data.tar.gz: a3acc16cb4123dd98c4d76d16efd587309111a15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f0058e6fefe6ac373d03d256d0020856f53ab323883f19e7712ea72bd1130d719e70fb9a57ae853684a86a4b46e1726808ea0fdee06ab7b8ebd0273e0386311
|
7
|
+
data.tar.gz: e50323c24f03be0cd75c66a152c9c8b653ad76dd65878784a8fb59b748e4486d38dcc5b59e5820746d4d6fd77d38cf08ffc1b2091fbadbafb09bb4f1b5ee78f1
|
data/bin/icersplicer
CHANGED
@@ -27,8 +27,7 @@ require File.expand_path(File.join(
|
|
27
27
|
File.dirname(__FILE__),
|
28
28
|
"../lib/version.rb"))
|
29
29
|
|
30
|
-
include GlobUtils
|
31
|
-
include Icersplicer
|
30
|
+
include GlobUtils, Icersplicer
|
32
31
|
|
33
32
|
trap("INT") {
|
34
33
|
puts "Goodbye see you soon!"
|
@@ -94,6 +93,21 @@ opts.each do |opt, arg|
|
|
94
93
|
--debug '-d' Verbose debug for hacking on this project
|
95
94
|
--nolines '-7' No Line numbers
|
96
95
|
|
96
|
+
Features:
|
97
|
+
|
98
|
+
Syntax highlighting / On / Off
|
99
|
+
Head /Tail functionality
|
100
|
+
Tail follow like tail -f
|
101
|
+
Support for multiple input for files / wildcards
|
102
|
+
Ability to Skip lines and line ranges and blank lines
|
103
|
+
Quiet mode for exporting large files
|
104
|
+
Countlines in a file
|
105
|
+
Grep functionality
|
106
|
+
Search & Replace in a file
|
107
|
+
Turn off line numbers
|
108
|
+
Debugging mode
|
109
|
+
Turn off line numbers
|
110
|
+
|
97
111
|
Example:
|
98
112
|
|
99
113
|
icersplicer -f inputfile --lineoffset 0 --linelimit 10 -s 3,6,9,10-15 -o outputfile
|
@@ -218,51 +232,55 @@ unless instance_variable_defined?("@nostats")
|
|
218
232
|
end
|
219
233
|
begin
|
220
234
|
# Regular file / glob mask processor
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
235
|
+
begin
|
236
|
+
filenames = joinfilenames(buildfilelist(inputfile))
|
237
|
+
# Iterator for file / file list
|
238
|
+
filenames.split(",").each {|f|
|
239
|
+
linecounter = 0
|
240
|
+
ice.reset_screen
|
241
|
+
puts "> Filename: #{f} <"
|
242
|
+
File.open(f) {|n|
|
243
|
+
n.each_line {|data|
|
244
|
+
data_orig = data.clone
|
245
|
+
if search_and_replace == true
|
246
|
+
data.gsub!("#{search}", "#{replace}")
|
247
|
+
end
|
248
|
+
unless lineoffset > increment_offset
|
249
|
+
unless linelimit == 0
|
250
|
+
unless increment_limit > linelimit
|
251
|
+
unless instance_variable_defined?("@skipblank") and data_orig.strip == ""
|
252
|
+
if data_orig =~ /#{grep}/
|
253
|
+
filterlines += 1
|
254
|
+
ice.print_to_screen(linecounter, ice.text_processor(data), quietmode) unless ice.skip(linecounter)
|
255
|
+
if instance_variable_defined?("@outputfile")
|
256
|
+
data_orig.gsub!("#{search}", "#{replace}")
|
257
|
+
ice.processdata(data_orig, outputfile, quietmode) unless ice.skip(linecounter)
|
258
|
+
end
|
259
|
+
end
|
243
260
|
end
|
244
261
|
end
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
262
|
+
else
|
263
|
+
unless instance_variable_defined?("@skipblank") and data_orig.strip == ""
|
264
|
+
if data_orig =~ /#{grep}/
|
265
|
+
filterlines += 1
|
266
|
+
ice.print_to_screen(linecounter, ice.text_processor(data), quietmode) unless ice.skip(linecounter)
|
267
|
+
if instance_variable_defined?("@outputfile")
|
268
|
+
data_orig.gsub!("#{search}", "#{replace}")
|
269
|
+
ice.processdata(data_orig, outputfile, quietmode) unless ice.skip(linecounter)
|
270
|
+
end
|
271
|
+
end
|
255
272
|
end
|
256
273
|
end
|
274
|
+
increment_limit += 1
|
257
275
|
end
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
linecounter += 1
|
276
|
+
increment_offset += 1
|
277
|
+
linecounter += 1
|
278
|
+
}
|
279
|
+
}
|
263
280
|
}
|
264
|
-
|
265
|
-
|
281
|
+
rescue
|
282
|
+
raise NoMethodError, "Please specify a valid filename or wildcard file extension"
|
283
|
+
end
|
266
284
|
rescue Errno::EPIPE, IOError
|
267
285
|
raise IOError, "Closing session due to broken pipe"
|
268
286
|
end
|
data/lib/version.rb
CHANGED