Top Forums Shell Programming and Scripting UNIX compare, sort lines and append difference Post 302843864 by nike27 on Thursday 15th of August 2013 11:42:41 AM
Old 08-15-2013
any thoughts ?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to Replace,Sort,and Append Character one script

Hi all i am very new to shell scripting,hope u guys can help i need to replace,sort and append character for the file that look like this: 1007032811010001000100000001X700026930409 1007032811010001000200000002X700026930409 1007032711020001000300000003X700026930409... (2 Replies)
Discussion started by: ashikin_8119
2 Replies

2. Shell Programming and Scripting

Compare & append

I need to write a Shell Script to compare two files & display the result. If the two files are different append them and store them in a new file. How do i proceed...can someone give me a coding ? (3 Replies)
Discussion started by: rohits1991
3 Replies

3. Shell Programming and Scripting

Compare two files and print the two lines with difference

I have two files like this: #FILE 1 ABCD 4322 26485 JMTJ 5311 97248 XMPJ 4321 58978 #FILE 2 ABCD 4321 26485 JMTJ 5311 97248 XMPJ 4321 68978 What to do: Compare the two files and find those lines that doesn't match. And have a new file like this: #FILE 3 "from file 1" ABCD 4322 26485... (11 Replies)
Discussion started by: kingpeejay
11 Replies

4. Shell Programming and Scripting

difference in unix vs. linux sort

Hi, I am using some codes that have been ported from unix to linux, and now the sorting no longer results in the desired ordering. I'm hoping to find a way to mimic the unix sort command in linux. The input file is structured the following: $> cat file.txt... (6 Replies)
Discussion started by: aj.schaeffer
6 Replies

5. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

6. UNIX for Dummies Questions & Answers

append following lines to 1st line, every 3 lines

I have output like this: USER_ID 12/31/69 19:00:00 12/31/69 19:00:00 USER_ID 12/31/69 19:00:00 12/31/69 19:00:00 USER_ID 12/31/69 19:00:00 12/31/69 19:00:00 USER_ID 12/31/69 19:00:00 12/31/69 19:00:00 ... where USER_ID is a unique user login followed by their login timestamp and... (6 Replies)
Discussion started by: MaindotC
6 Replies

7. Shell Programming and Scripting

UNIX compare, sort lines and append difference

Hi, I have a file that needs to be converted: content is: a, b, 4 a ,b, 5 x, y, 1 a, b, 1 x, y, 3 how can i get: a, b, 1|4|5 x,y 1|3 (1 Reply)
Discussion started by: nike27
1 Replies

8. Shell Programming and Scripting

UNIX compare, sort lines and append difference

To make it easier, i gave following example. It is not homework or classwork. Instead, i have a huge csv file dump from tsql with 15 columns and around 300 rows. I was able to extract content that needs to be really converted. Here is the extract: ES FP,B1ES FP,70000,I,SL22,SL22 (70000) ES... (0 Replies)
Discussion started by: nike27
0 Replies

9. Shell Programming and Scripting

Compare file1 for matching line in file2 and print the difference in matching lines

Hello, I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies

10. UNIX for Beginners Questions & Answers

Difference of Sort -n -k2 -k3 & Sort -n -k2,3

Hi, Could anyone kindly show me a link or explain the difference between sort -n -k2 -k3 & sort -n -k2,3 Also, if I like to remove the row with repetition at both $2 and $3, Can I safely use sort -u -k2 -k3 Example; 100 20 30 100 20 30 So, both $2 and $3 are same and I... (2 Replies)
Discussion started by: Indra2011
2 Replies
pods::SDLx::Sprite(3pm) 				User Contributed Perl Documentation				   pods::SDLx::Sprite(3pm)

NAME
SDLx::Sprite - interact with images quick and easily in SDL CATEGORY
Extension SYNOPSIS
use SDLx::Sprite; my $sprite = SDLx::Sprite->new; # loads image file into a SDL::Surface and # automatically sets a SDL::Rect inside with # that image's dimensions. $sprite->load('hero.png'); # set sprite image transparency $sprite->alpha_key( $color ); $sprite->alpha(0.5); # you can set and check the sprite position anytime say $sprite->x; # rect->x shortcut accessor $sprite->y(30); # rect->y shortcut accessor # read-only surface dimensions $sprite->w; # width $sprite->h; # height # you can also fetch the full rect # (think destination coordinates for ->draw) my $rect = $sprite->rect; # you can get the surface object too if you need it my $surface = $sprite->surface; # rotation() # if your SDL has gfx, rotation is also straightforward: $sprite->rotation( $degrees ); $sprite->rotation( $degrees, $smooth ); # add() / remove() NOT YET IMPLEMENTED # you can also attach other sprites to it $sprite->add( armor => $other_sprite ); $sprite->remove('armor'); # blits $sprite (and attached sprites) into $screen, # in the (x,y) coordinates of the sprite $sprite->draw($screen); # if you need to clip the original image/surface # before drawing it $sprite->clip->x(10); $sprite->clip->y(3); $sprite->clip->w(5); $sprite->clip->h(5); # ...or all at once: $sprite->clip($x,$y,$w,$h); # spawning can include almost all of the above: my $sprite = SDLx::Sprite->new( image => 'hero.png', # or surface => SDL::Surface rect => SDL::Rect, # or x => $x, y => $y clip => SDL::Rect, alpha_key => SDL::Color, # or [$r, $g, $b] alpha => 1, rotation => 45, # degrees ); DESCRIPTION
SDLx::Sprite is a SDL::Surface on steroids! It let's you quickly load, setup and interact with images in your SDL application, abstracting all the drudge code and letting you concentrate on your app's logic instead. This module automatically creates and holds SDL::Rect objects for the source and destination surfaces, and provides several surface manipulation options like alpha blending and rotation. WARNING! VOLATILE CODE AHEAD This is a new module and the API is subject to change without notice. If you care, please join the discussion on the #sdl IRC channel in irc.perl.org. All thoughts on further improving the API are welcome. You have been warned :) METHODS
new new( %options ) Creates a new SDLx::Sprite object. No option is mandatory. Available options are: o image => $filename Uses $filename as source image for the Sprite's surface. See supported formats in SDL::Image. This option cannot be used together with the 'surface' option (see below). o surface => SDL::Surface Uses the provided SDL::Surface object as source surface for this sprite, instead of creating one automatically. This option cannot be used together with the 'image' option (see above). o clip => SDL::Rect Uses the provided SDL::Rect object as clipping rect for the source surface. This means the object will only blit that particular area from the surface. o rect => SDL::Rect Uses the provided SDL::Rect object as destination coordinates to whatever surface you call draw() on. You cannot use this option together with 'x' and 'y' (see below) o x => $x Uses $x as the x-axis (left-to-right, 0 being leftmost) positioning of the Sprite into the destination you call draw() upon. This option cannot be used together with 'rect' (see above). o y => $y Uses $y as the y-axis (top-to-bottom, 0 being topmost) positioning of the Sprite into the destination you call draw() upon. This option cannot be used together with 'rect' (see above). o draw_xy => $surface, $x, $y A shortcut to draw at coordinates quickly. Calls x() , y() and draw() o rotation => $degrees, [$smooth] Uses $degrees as the angle to rotate the surface to, in degrees (0..360, remember? :). This option is only available if your compiled SDL library has support for GFX (see Alien::SDL for details). if $smooth is set the sprite is antialiased. This may mess with your alpha_key. o alpha_key => SDL::Color MUST CALL SDL::Video::get_video_mode prior to this. Uses the provided SDL::Color object (or an array reference with red, green and blue values) as the color to be turned into transparent (see 'alpha' below). o alpha => $percentage or $integer Uses $percentage (0 <-> 1 ) or $integer ( 0x01 - 0xff) as how much transparency to add to the surface. If you use this, it is mandatory that you also provide the alpha_key (see above). load( $filename ) Loads the given image file into the object's internal surface. A new surface is always created, so whatever you had on the previous surface will be lost. Croaks on errors such as no support built for the image or a file reading error (the error message is SDL::get_error and should give more details). Returns the own Sprite object, to allow method chaining. surface() surface( SDL::Surface ) Returns the object's internal surface, or undef if there is none. If you pass a SDL::Surface to it, it will overwrite the original surface with it, while returning the old (previous) surface. Note that, as such, it will return "undef" if you use it without having previously loaded either an image or a previous surface. It will Carp::confess if you pass anything that's not an SDL::Surface object (or SDL::Surface subclassed objects). rect() rect( SDL::Rect ) Returns the destination SDL::Rect object used when you call draw(). If you haven't explicitly set it, it will be a SDL::Rect with the same dimensions as the object's internal surface. If no surface was set yet, it will be an empty SDL::Rect (dimensions 0,0,0,0). If you pass it a SDL::Rect object, it will set rect() to that object before returning, but it will overwrite any width and height values, as those are read only and set to the size of the underlying surface. If you want to clip the source surface, set clip() instead. clip() clip( SDL::Rect ) Returns the source SDL::Rect object used when you call draw(). You can use this method to choose only a small subset of the object's internal surface to be used on calls to draw(). If you haven't explicitly set it, it will be a SDL::Rect with the same dimensions as the object's internal surface. If no surface was set yet, it will be an empty SDL::Rect (dimensions 0,0,0,0). If you pass it a SDL::Rect object, it will set clip() to that object before returning. x() x( $int ) Gets/sets the x-axis (left-to-right, 0 being leftmost) positioning of the Sprite into the destination you call draw() upon. It is a shortcut to "$sprite->rect->x". y() y( $int ) Gets/sets the y-axis (top-to-bottom, 0 being topmost) positioning of the Sprite into the destination you call draw() upon. It is a shortcut to "$sprite->rect->y". w() Returns the Sprite surface's width. This method is read-only. It is a shortcut to "$sprite->surface->w". h() Returns the Sprite surface's height. This method is read-only. It is a shortcut to "$sprite->surface->h". draw( SDL::Surface ) Draws the Sprite on the provided SDL::Surface object - usually the screen - using the blit_surface SDL function, using the source rect from clip() and the destination rect (position) from rect(). Returns the own Sprite object, to allow method chaining. AUTHORS
See "AUTHORS" in SDL. SEE ALSO
SDL::Surface, SDL perl v5.14.2 2012-05-28 pods::SDLx::Sprite(3pm)

Featured Tech Videos

All times are GMT -4. The time now is 07:46 AM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy