Sponsored Content
Full Discussion: Major File Reformat
Top Forums Shell Programming and Scripting Major File Reformat Post 302586435 by Blue Solo on Monday 2nd of January 2012 02:41:40 AM
Old 01-02-2012
Major File Reformat

Hello, I have many lengthy files that need to be reformatted. I was hoping a sed or awk script could fix this.

Here is an example of the original format:
Code:
P0037
# Degree: 32.999981
# COMMAND: 03 (#01A) Scale 1.296875, 52 (Wooden Crate w/ #2 Label, Bahko)
v -3328.000000 12.101541 437.000000
P0038
# Degree: 115.120972
# COMMAND: 0A (#000) Scale 1.000000, 4B (Television Monitor)
v -3394.000000 -123.668777 419.000000
P0039
# Degree: 127.290268
# COMMAND: 03 (#052) Scale 1.000000, 2D (Computer Keyboard)
v -3386.000000 -127.500473 416.000000
P003A
# Degree: 126.991837
# COMMAND: 03 (#051) Scale 1.000000, 26 (Desk w/ Kickplate)
v -3388.000000 -139.089020 421.000000

And this is how the above should be formatted:
Code:
var P0037 : Transform = Instantiate(prop52, (Vector3(-3328.000000, 12.101541, 437.000000) * scaleFactor) + mapPos, Quaternion.Euler(prop52.transform.eulerAngles.x, 32.999981, prop52.transform.eulerAngles.z));
P0037.transform.localScale = Vector3(1.296875, 1.296875, 1.296875) * scale;
P0037.transform.parent = objectControl.transform;

var P0038 : Transform = Instantiate(prop4B, (Vector3(-3394.000000, -123.668777, 419.000000) * scaleFactor) + mapPos, Quaternion.Euler(prop4B.transform.eulerAngles.x, 115.120972, prop4B.transform.eulerAngles.z));
P0038.transform.localScale = Vector3(1.000000, 1.000000, 1.000000) * scale;
P0038.transform.parent = objectControl.transform;

var P0039 : Transform = Instantiate(prop2D, (Vector3(-3386.000000, -127.500473, 416.000000) * scaleFactor) + mapPos, Quaternion.Euler(prop2D.transform.eulerAngles.x, 127.290268, prop2D.transform.eulerAngles.z));
P0039.transform.localScale = Vector3(1.000000, 1.000000, 1.000000) * scale;
P0039.transform.parent = objectControl.transform;

var P003A : Transform = Instantiate(prop26, (Vector3(-3388.000000, -139.089020, 421.000000) * scaleFactor) + mapPos, Quaternion.Euler(prop26.transform.eulerAngles.x, 126.991837, prop26.transform.eulerAngles.z));
P003A.transform.localScale = Vector3(1.000000, 1.000000, 1.000000) * scale;
P003A.transform.parent = objectControl.transform;

I am attaching one of the files if it helps.
If there is any confusion or more information is needed, please let me know. Thank you very much! Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

reformat the file

Hi all, I ran into this problem, hope you can help I have a text file like this: Spriden ID First Name Last Name Term Code Detail Code Amount Trans Date Description ... (3 Replies)
Discussion started by: CamTu
3 Replies

2. Shell Programming and Scripting

Reformat Crontab file

I need help writing a script that will reformat a crontab file. The first thing the script is doing is a crontab -l > crontab.txt. I need the crontab.txt file to read "8.00 PM every weekday (Mon-Fri) only in Oct." instead of the orig format "0 20 * 10 1-5" (1 Reply)
Discussion started by: alnita
1 Replies

3. Programming

which head file for major and minor function?

#include <sys/types.h> #include <sys/stat.h> #include <sys/termios.h> #include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <string.h> #include <unistd.h> #include <signal.h> #include <sys/mkdev.h> int main(int argc, char *argv) { int i; struct stat buf; ... (4 Replies)
Discussion started by: konvalo
4 Replies

4. Shell Programming and Scripting

Please help me reformat this file

I am working with a file of the form; 4256 7726 1 6525 716 1 7626 0838 1 8726 7623 2 8625 1563 2 1662 2628 3 1551 3552 3 1542 7984 ... (3 Replies)
Discussion started by: digipak
3 Replies

5. Shell Programming and Scripting

Reformat a file

I have a csv file with 11 columns. The first columns contains the User Id. One User id can have multiple sub Id. The value of Sub Id is in column 10. 100026,captjason@hawaii.rr.com ,jason ,wolford ,1/16/1969, ,US, ,96761 ,15 ,seg_id 100026,captjason@hawaii.rr.com ,jason ,wolford ,1/16/1969,... (3 Replies)
Discussion started by: r_t_1601
3 Replies

6. Shell Programming and Scripting

Reformat file using nawk

Hi all, I have a file with records that look something like this, "Transaction ID",Date,Email,"Card Type",Amount,"NETBANX Ref","Root Ref","Transaction Type","Merchant Ref",Status,"Interface ID","Interface Name","User ID" nnnnnnnnn,"21 Nov 2011 00:10:47",someone@hotmail.co.uk,"Visa... (2 Replies)
Discussion started by: dazedandconfuse
2 Replies

7. Shell Programming and Scripting

awk reformat file

Hello: When I tried a perl-oneliner to re-format fasta file. infile.fasta >YAL069W-1.334 Putative promoter CCACACCACACCCACACACC ACACCACACCCACACACACA ACAGCCCTAATCTAACCC >YAL068C-7235.2170 Putative ABC sequence TACGAGAATAATTT ACGTAAATGAAGTT TATATATAAA >gi|31044174|gb|AY143560.1|... (15 Replies)
Discussion started by: yifangt
15 Replies

8. Shell Programming and Scripting

[Solved] File reformat

I am using the code below to reformat the input (hp.txt). The output (newhp.txt) is not in the desired format and I can not seem to figure it out. I have attached both. Thank you. perl -aF/\\t/ -lne 'print join(" ",@F) for ("0 A","0 G","0 C","0 T","A 0","G 0","C 0","T 0")' hp.txt > newhp.txt ... (4 Replies)
Discussion started by: cmccabe
4 Replies

9. Shell Programming and Scripting

Reformat csv file

Hi, I have a csv file with content like: 1,0,100 1,1,150 2,0,200 2,1,250 3,0,300 3,1,350 I want an output such that all numbers in 3rd col where 2nd col is "0" come in the same col in the output. The same goes for numbers where 2nd col is "1". 1 100 150 2 200 250 3 300 350 Tnx... (2 Replies)
Discussion started by: jamaje
2 Replies

10. Shell Programming and Scripting

awk to reformat output if input file is empty, but not if file has data in it

The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format: input chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18 chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)
Discussion started by: cmccabe
3 Replies
PRINTER_SELECT_BRUSH(3) 						 1						   PRINTER_SELECT_BRUSH(3)

printer_select_brush - Select a brush

SYNOPSIS
void printer_select_brush (resource $printer_handle, resource $brush_handle) DESCRIPTION
The function selects a brush as the active drawing object of the actual device context. A brush is used to fill shapes. If you draw an rectangle the brush is used to draw the shapes, while the pen is used to draw the border. If you haven't selected a brush before drawing shapes, the shape won't be filled. PARAMETERS
o $printer_handle -$printer_handle must be a valid printer handle. o $brush_handle -$brush_handle must be a valid brush handle. RETURN VALUES
No value is returned. EXAMPLES
Example #1 printer_select_brush(3) example <?php $handle = printer_open(); printer_start_doc($handle, "My Document"); printer_start_page($handle); $pen = printer_create_pen(PRINTER_PEN_SOLID, 2, "000000"); printer_select_pen($handle, $pen); $brush = printer_create_brush(PRINTER_BRUSH_CUSTOM, "c:\brush.bmp"); printer_select_brush($handle, $brush); printer_draw_rectangle($handle, 1, 1, 500, 500); printer_delete_brush($brush); $brush = printer_create_brush(PRINTER_BRUSH_SOLID, "000000"); printer_select_brush($handle, $brush); printer_draw_rectangle($handle, 1, 501, 500, 1001); printer_delete_brush($brush); printer_delete_pen($pen); printer_end_page($handle); printer_end_doc($handle); printer_close($handle); ?> PHP Documentation Group PRINTER_SELECT_BRUSH(3)
All times are GMT -4. The time now is 04:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy