Sponsored Content
Top Forums Shell Programming and Scripting How to convert a space delimited file into a pipe delimited file using shellscript? Post 302558718 by anishkumarv on Sunday 25th of September 2011 04:18:52 AM
Old 09-25-2011
Is that color is essential?? because we cant able to understand your requirement??
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Converting Space delimited file to Tab delimited file

Hi all, I have a file with single white space delimited values, I want to convert them to a tab delimited file. I tried sed, tr ... but nothing is working. Thanks, Rajeevan D (16 Replies)
Discussion started by: jeevs81
16 Replies

2. Shell Programming and Scripting

convert a pipe delimited file to a':" delimited file

i have a file whose data is like this:: osr_pe_assign|-120|wg000d@att.com|4| osr_evt|-21|wg000d@att.com|4| pe_avail|-21|wg000d@att.com|4| osr_svt|-11|wg000d@att.com|4| pe_mop|-13|wg000d@att.com|4| instar_ready|-35|wg000d@att.com|4| nsdnet_ready|-90|wg000d@att.com|4|... (6 Replies)
Discussion started by: priyanka3006
6 Replies

3. Shell Programming and Scripting

Convert CSV file (with double quoted strings) to pipe delimited file

Hi, could some help me convert CSV file (with double quoted strings) to pipe delimited file: here you go with the same data: 1,Friends,"$3.99 per 1,000 listings",8158here " 1,000 listings " should be a single field. Thanks, Ram (8 Replies)
Discussion started by: Ram.Math
8 Replies

4. Shell Programming and Scripting

Help with converting Pipe delimited file to Tab Delimited

I have a file which was pipe delimited, I need to make it tab delimited. I tried with sed but no use cat file | sed 's/|//t/g' The above command substituted "/t" not tab in the place of pipe. Sample file: abc|123|2012-01-30|2012-04-28|xyz have to convert to: abc 123... (6 Replies)
Discussion started by: karumudi7
6 Replies

5. Shell Programming and Scripting

How to make tab delimited file to space delimited?

Hi How to make tab delimited file to space delimited? in put file: ABC kgy jkh ghj ash kjl o/p file: ABC kgy jkh ghj ash kjl Use code tags, thanks. (1 Reply)
Discussion started by: jagdishrout
1 Replies

6. Shell Programming and Scripting

How to convert space&tab delimited file to CSV?

Hello, I have a text file with space and tab (mixed) delimited file and need to convert into CSV. # cat test.txt /dev/rmt/tsmmt32 HP Ultrium 6-SCSI J3LZ 50:03:08:c0:02:72:c0:b5 F00272C0B5 0/0/6/1/1.145.17.255.0.0.0 /dev/rmt/c102t0d0BEST /dev/rmt/tsmmt37 ... (6 Replies)
Discussion started by: prvnrk
6 Replies

7. UNIX for Dummies Questions & Answers

Need to convert a pipe delimited text file to tab delimited

Hi, I have a rquirement in unix as below . I have a text file with me seperated by | symbol and i need to generate a excel file through unix commands/script so that each value will go to each column. ex: Input Text file: 1|A|apple 2|B|bottle excel file to be generated as output as... (9 Replies)
Discussion started by: raja kakitapall
9 Replies

8. Shell Programming and Scripting

UNIX/PERL script to convert XML file to pipe delimited format

Hello, I need to get few values from a XML file and output needs to be written in another file with pipe delimited format. The Header & Footer of the Pipe Delimited file will be constant. The below is my sample XML file. I need to pull the values in between the XML tags <Operator_info to... (15 Replies)
Discussion started by: karthi1305561
15 Replies

9. Shell Programming and Scripting

Convert pipe demilited file to vertical tab delimited

Hi All, How can we convert pipe delimited ( or comma ) file to vertical tab (VT) delimited. Regards PK (4 Replies)
Discussion started by: prasson_ibm
4 Replies

10. Shell Programming and Scripting

Linux convert Comma delimited file to pipe

I have file in linux with comma delimited and string fields in double quotations ", I need to convert them to pipe delimiter please share your inputs. Example: Input: "2017-09-30","ACBD,TVF","01234",NULL,18,NULL,"686091802","BANK OF ABCD, LIMITED, THE",790456 Output: ... (4 Replies)
Discussion started by: shieksir
4 Replies
SDL_PixelFormat(3)						 SDL API Reference						SDL_PixelFormat(3)

NAME
SDL_PixelFormat - Stores surface format information STRUCTURE DEFINITION
typedef struct SDL_PixelFormat { SDL_Palette *palette; Uint8 BitsPerPixel; Uint8 BytesPerPixel; Uint8 Rloss, Gloss, Bloss, Aloss; Uint8 Rshift, Gshift, Bshift, Ashift; Uint32 Rmask, Gmask, Bmask, Amask; Uint32 colorkey; Uint8 alpha; } SDL_PixelFormat; STRUCTURE DATA
palette Pointer to the palette, or NULL if the BitsPerPixel>8 BitsPerPixel The number of bits used to represent each pixel in a surface. Usually 8, 16, 24 or 32. BytesPerPixel The number of bytes used to represent each pixel in a surface. Usually one to four. [RGBA]mask Binary mask used to retrieve individual color values [RGBA]loss Precision loss of each color component (2^[RGBA]loss) [RGBA]shift Binary left shift of each color component in the pixel value colorkey Pixel value of transparent pixels alpha Overall surface alpha value DESCRIPTION
A SDL_PixelFormat describes the format of the pixel data stored at the pixels field of a SDL_Surface. Every surface stores a SDL_PixelFor- mat in the format field. If you wish to do pixel level modifications on a surface, then understanding how SDL stores its color information is essential. 8-bit pixel formats are the easiest to understand. Since its an 8-bit format, we have 8 BitsPerPixel and 1 BytesPerPixel. Since BytesPer- Pixel is 1, all pixels are represented by a Uint8 which contains an index into palette->colors. So, to determine the color of a pixel in a 8-bit surface: we read the color index from surface->pixels and we use that index to read the SDL_Color structure from surface->for- mat->palette->colors. Like so: SDL_Surface *surface; SDL_PixelFormat *fmt; SDL_Color *color; Uint8 index; . . /* Create surface */ . . fmt=surface->format; /* Check the bitdepth of the surface */ if(fmt->BitsPerPixel!=8){ fprintf(stderr, "Not an 8-bit surface. "); return(-1); } /* Lock the surface */ SDL_LockSurface(surface); /* Get the topleft pixel */ index=*(Uint8 *)surface->pixels; color=fmt->palette->colors[index]; /* Unlock the surface */ SDL_UnlockSurface(surface); printf("Pixel Color-> Red: %d, Green: %d, Blue: %d. Index: %d ", color->r, color->g, color->b, index); . . Pixel formats above 8-bit are an entirely different experience. They are considered to be "TrueColor" formats and the color information is stored in the pixels themselves, not in a palette. The mask, shift and loss fields tell us how the color information is encoded. The mask fields allow us to isolate each color component, the shift fields tell us the number of bits to the right of each component in the pixel value and the loss fields tell us the number of bits lost from each component when packing 8-bit color component in a pixel. /* Extracting color components from a 32-bit color value */ SDL_PixelFormat *fmt; SDL_Surface *surface; Uint32 temp, pixel; Uint8 red, green, blue, alpha; . . . fmt=surface->format; SDL_LockSurface(surface); pixel=*((Uint32*)surface->pixels); SDL_UnlockSurface(surface); /* Get Red component */ temp=pixel&fmt->Rmask; /* Isolate red component */ temp=temp>>fmt->Rshift;/* Shift it down to 8-bit */ temp=temp<<fmt->Rloss; /* Expand to a full 8-bit number */ red=(Uint8)temp; /* Get Green component */ temp=pixel&fmt->Gmask; /* Isolate green component */ temp=temp>>fmt->Gshift;/* Shift it down to 8-bit */ temp=temp<<fmt->Gloss; /* Expand to a full 8-bit number */ green=(Uint8)temp; /* Get Blue component */ temp=pixel&fmt->Bmask; /* Isolate blue component */ temp=temp>>fmt->Bshift;/* Shift it down to 8-bit */ temp=temp<<fmt->Bloss; /* Expand to a full 8-bit number */ blue=(Uint8)temp; /* Get Alpha component */ temp=pixel&fmt->Amask; /* Isolate alpha component */ temp=temp>>fmt->Ashift;/* Shift it down to 8-bit */ temp=temp<<fmt->Aloss; /* Expand to a full 8-bit number */ alpha=(Uint8)temp; printf("Pixel Color -> R: %d, G: %d, B: %d, A: %d ", red, green, blue, alpha); . . . SEE ALSO
SDL_Surface, SDL_MapRGB SDL
Tue 11 Sep 2001, 23:01 SDL_PixelFormat(3)
All times are GMT -4. The time now is 07:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy