Sponsored Content
Full Discussion: sorting
Top Forums Shell Programming and Scripting sorting Post 302490471 by kurumi on Monday 24th of January 2011 10:31:11 PM
Old 01-24-2011
Code:
 $ ruby -e 'a=open("file").read.split("\n"); puts a[0];puts a[1..-1].sort.uniq' > newfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need immediate help with sorting!!!

hey, I have a file that looks smthng like this: /*--- abcd_0050 ---*/ asdfjk adsfkja lkjljgafsd /*---abcd_0005 ---*/ lkjkljbfkgj ldfksjgf dfkgfjb /*-- abcd_0055--*/ klhfdghd dflkjgd jfdg I would like it to be sorted so that it looks like this: /*---abcd_0005 ---*/ lkjkljbfkgj (9 Replies)
Discussion started by: sasuke_uchiha
9 Replies

2. UNIX for Dummies Questions & Answers

Sorting help

how can i sort the next list just by look at the numbers (ignore letters) example: abc123 dff4f aaa2aa bbbb55555bb output: aaa2aa dff4f abc123 bbbb55555bb (1 Reply)
Discussion started by: nirnir26
1 Replies

3. UNIX for Dummies Questions & Answers

Sorting help

i have list of files: Wang De Wong CVPR 09.pdf Yaacob AFGR 99 Second edition.pdf Shimon CVPR 01.pdf Den CCC 97 long one.pdf Ronald De Bour CSPP 04.pdf ..... how can i sort this directory so the output will be in the next format: <year>\t<conference/journal>\t<author list> - t is tab (its... (1 Reply)
Discussion started by: nirnir26
1 Replies

4. Homework & Coursework Questions

Sorting help

i have list of files: Wang De Wong CVPR 09.pdf Yaacob AFGR 99 Second edition.pdf Shimon CVPR 01.pdf Den CCC 97 long one.pdf Ronald De Bour CSPP 04.pdf ..... how can i sort this directory so the output will be in the next format: <year>\t<conference/journal>\t<author list> - t is tab (its... (1 Reply)
Discussion started by: nirnir26
1 Replies

5. Shell Programming and Scripting

Sorting

Let's say that I have a database that I call part ID. This database has the following grouping: Dart1=4 Dart2=8 Dart3=12 Fork1=68 Fork2=72 Fork3=64 Bike1=28 Bike2=24 Bike3=20 Car1=44 Car2=40 Car3=36 I want to write a program that would read this database and tell me when the... (19 Replies)
Discussion started by: Ernst
19 Replies

6. UNIX for Dummies Questions & Answers

HELP on sorting

hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this; 192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible... (1 Reply)
Discussion started by: sam127
1 Replies

7. UNIX for Advanced & Expert Users

HELP on sorting

hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this; 192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible... (1 Reply)
Discussion started by: sam127
1 Replies

8. Shell Programming and Scripting

Sorting HELP

Hi, I have posted related topic but as i continue the research I find more need to sort the data. AS(2607:f278:4101:11:dead:beef:f00f:f), AS786 AS6453 AS7575 AS7922 AS(2607:f2e0:f:1db::16), AS786 AS3257 AS36252 AS786 AS3257 AS36252 AS(2607:f2f8:1700::2), AS786 AS6939 AS25795 ... (6 Replies)
Discussion started by: sam127
6 Replies

9. Shell Programming and Scripting

sorting

Hi all, Does anyone can help me the following question? I would like to write an AWK script. In the following input file, each number in "start" is paired with numbers in column "end". No Start End A 22,222,33,22,1233,3232,44 555,333,222,55,1235,3235,66... (7 Replies)
Discussion started by: phoeberunner
7 Replies

10. Shell Programming and Scripting

sorting help

Hi, Please i need help in writing an 'awk' script in sorting the following data; traceroute6 to 2001:1ba0:2a0:5965:0:30:24:1 (2001:1ba0:2a0:5965:0:30:24:1) from 2001:418:1::62, 64 hops max, 16 byte packets 1 2001:418:1::4 0.342 ms 2 2001:418:1::1 0.630 ms 3 2001:504:16::1b1b 0.393 ms 4... (6 Replies)
Discussion started by: sam127
6 Replies
libcaca-ruby-api(3caca) 					      libcaca						   libcaca-ruby-api(3caca)

NAME
libcaca-ruby-api - Libcaca Ruby API Classes The classes available for libcaca are : o Caca::Canvas : functions that have a caca_canvas_t* as first argument o Caca::Dither : functions that have a caca_dither_t* as first argument o Caca::Font : functions that have a caca_font_t* as first argument (The constructor can currently only accept the name of a builtin font) o Caca::Display o Caca::Event o Caca::Event::Key o Caca::Event::Key::Press o Caca::Event::Key::Release o Caca::Event::Mouse o Caca::Event::Mouse::Press o Caca::Event::Mouse::Release o Caca::Event::Mouse::Motion o Caca::Event::Resize o Caca::Event::Quit The character set conversion functions are not available yet in the binding. $ irb -rcaca irb(main):001:0> class Object irb(main):002:1> def Object.my_instance_methods irb(main):003:2> instance_methods.sort - ancestors[1].instance_methods irb(main):004:2> end irb(main):005:1> def Object.my_methods irb(main):006:2> methods.sort - ancestors[1].methods irb(main):007:2> end irb(main):008:1> end irb(main):009:0> Caca.constants => ['BROWN', 'BOLD', 'GREEN', 'LIGHTMAGENTA', 'LIGHTBLUE', 'BLINK', irb(main):010:0> Caca.my_methods => ['version'] irb(main):011:0> Caca::Canvas.my_methods => ['export_list', 'import_list'] irb(main):012:0> Caca::Canvas.my_instance_methods => ['attr=', 'blit', 'clear', 'create_frame', irb(main):013:0> Caca::Font.my_methods => ['list'] irb(main):014:0> Caca::Font.my_instance_methods => ['blocks', 'height', 'width'] irb(main):015:0> Caca::Dither.my_instance_methods => ['algorithm=', 'algorithm_list', 'antialias=', 'antialias_list', irb(main):010:0> Caca::Display.my_instance_methods => ['canvas', 'get_event', 'height', 'mouse=', 'mouse_x', 'mouse_y', 'refresh', irb(main):011:0> Caca::Event.constants => ['Key', 'Quit', 'TYPE', 'Mouse', 'Resize'] irb(main):012:0> Caca::Event.my_instance_methods => ['quit?'] irb(main):013:0> Caca::Event::Key.my_instance_methods => ['ch', 'utf32', 'utf8'] irb(main):014:0> Caca::Event::Mouse.my_instance_methods => ['button', 'x', 'y'] irb(main):015:0> Caca::Event::Resize.my_instance_methods => ['w', 'h'] Samples $ ruby -rcaca -e 'c=Caca::Canvas.new(6, 3).fill_box(0,0,2,2,'#'[0]); c2=Caca::Canvas.new(1,1).put_str(0,0,'x'); c.blit(1,1,c2); puts c.export_to_memory('irc')' ### #x# ### $ ruby -e 'puts Caca::Canvas.new(6,3).draw_thin_polyline([[0,0], [0,2], [5,2],[0,0]]).export_to_memory('irc')' -. | `. ----`- $ ruby -rcaca -e 'p Caca::Canvas.export_list' [['caca', 'native libcaca format'], ['ansi', 'ANSI'], ['utf8', 'UTF-8 withANSI escape codes'], ['utf8cr', 'UTF-8 with ANSI escape codes and MS-DOS '], ['html', 'HTML'], ['html3', 'backwards-compatible HTML'], ['irc', 'IRC with mIRC colours'], ['ps', 'PostScript document'], ['svg', $ ruby -rcaca -e 'p Caca::Font.list' ['Monospace9', 'Monospace Bold 12'] require 'caca' c = Caca::Canvas.new(20,10) c.put_str(2,3, 'plop!') c.draw_thin_polyline([[0,0],[0,2], [5,2], [0,0]]) d = Caca::Display.new(c) d.title= 'Test !' d.refresh #Redefine Event::Key#quit? so that q, Q, and Esc become exit keys module Caca class Event::Key def quit? 'qQ^['.split('').member?(@ch.chr) end end end while((e= d.get_event(Caca::Event, -1)) && ! e.quit?) p e d.refresh end Version 0.99.beta18 Fri Apr 6 2012 libcaca-ruby-api(3caca)
All times are GMT -4. The time now is 07:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy