11-15-2005
Giving format to a file
hi all,
i have a big problem and i don't know what to do. This is the thing: i have a flat file with 26 fields, which are separated by ';'
by example, i have this:
Peter;Smith;2005;200508; .........
if the lengths of the fields are:
field 1: Alphanumeric[10] - field 2: Alphanumeric[10] - field 3: numeric[8] - field 4: numeric [10] - etc ....
i want this:
Peter ;Smith ;00002005;0000200508;
I need giving format to each field, to get the length of each field, which is established. if the field is numeric, i must fill with zeroes to the left of the number, until the length of the field is completed. if the field is alphanumeric, i must field whit blank spaces to the rigth of the value.
an important thing, is what i must keep the field separator (
.
how can i do thatΏ?
please, help me
thanks for your help
10 More Discussions You Might Find Interesting
1. Solaris
I'm trying to install the recommended patch cluster on a x86 Solaris 10 box.
I get this error:
ERROR: /sbin/zonename cannot be found. install_cluster for 10_x86 patch cluster not applied. Exiting.
I tried touching the file and it gave a different error of: expected argument..
anyone... (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies
2. UNIX for Advanced & Expert Users
:) Hi
i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error
Function i used it as
$ iconv -f UTF8 -t ANSI filename
Error iam getting is NOT Supported UTF8 to ANSI
please some help me out on this.........Let me... (1 Reply)
Discussion started by: rajreddy
1 Replies
3. UNIX for Dummies Questions & Answers
:confused: Hi
i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error
Function i used it as
$ iconv -f UTF8 -t ANSI filename
Error iam getting is NOT Supported UTF8 to ANSI
please some help me out on... (9 Replies)
Discussion started by: rajreddy
9 Replies
4. Shell Programming and Scripting
My C++ program creates a nxn matrix with given value. For e.g if the input is 10 it will creates a matrix of 10x10 now what i want is the script should run program and give input values in a variation of 1000. Say first matrix of 1000 then 2000 , 3000 ..... 10000. I tried using for loop but unable... (2 Replies)
Discussion started by: tonyaim83
2 Replies
5. Shell Programming and Scripting
Hi,
I have a file like this:
mgr1.dbf
tool.dbf
usr.dbf
wow19.dbf
wow2wow.dbf
Can anyone help change the format after each line of reading to:
mgr2.dbf # add 1 of *1.dbf
tool2.dbf # if not a number exist, make it default to 2
usr2.dbf
wow20.dbf # add 1 of *19.dbf
wow3wow.dbf ... (5 Replies)
Discussion started by: netbanker
5 Replies
6. UNIX for Dummies Questions & Answers
Hi
I have a file which has ascii , binary, binary decimal coded,decimal & hexadecimal data with lot of special characters (like φ..έέ‘·.έέ‘· ) in it. I want to standardize the file into ASCII format & later use that as source .
Can any one suggest a way a logic to convert such... (5 Replies)
Discussion started by: gaur.deepti
5 Replies
7. Shell Programming and Scripting
How to execute a script with out giving x permission to the file? (7 Replies)
Discussion started by: praveen_b744
7 Replies
8. Shell Programming and Scripting
Hi,
I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix.
My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies
9. Shell Programming and Scripting
hi I would like to sort rows in a givin file except the first colomn (or first element of a row) just like the following example
file input :
1 3 8 5
2 2 8 1
3 9 8 10
file output :
1 8 5 3
2 8 2 1
3 10 9 8 (4 Replies)
Discussion started by: yassinegoth
4 Replies
10. Shell Programming and Scripting
Hi,
Its bit urget for me to complete. pls help me.
I am parsing 2 file 1. INDATA(Data file) 2. GRPFIL(Reference)
every record in INDATA should be verified with GRP_DATA.
I am seeing the output from only the last line of ref file, its not searching all the lines.
INDATA sample... (1 Reply)
Discussion started by: hyperion.krish
1 Replies
LEARN ABOUT DEBIAN
srec_ti_tagged_16
srec_ti_tagged_16(5) File Formats Manual srec_ti_tagged_16(5)
NAME
srec_ti_tagged_16 - Texas Instruments Tagged (SDSMAC 320) file format
DESCRIPTION
This format is also known as the TI-Tagged or Texas Instruments SDSMAC (320) format.
This format allows binary files to be uploaded and downloaded between two computer systems, typically between a computer system (such as a
PC, Macintosh, or workstation) and an emulator or evaluation board for 16-bit microcontrollers and microprocessors.
The Lines
Unlike many other object formats, the lines themselves are not especially significant. The format consits of a number of tagged fields,
and lines are composed of a series of these fields.
Tag Description
-------------------------------------
* Data byte.
: End of file.
0 File header (optional).
7 Checksum.
8 Dummy checksum (ignored).
9 Word Address.
B Data word.
F End of data record.
K Program identifier (optional).
Data Byte
+--+---+---+
|B | n | n |
One byte of data. The nn is 8-bit big-endian hexadecimal. +--+---+---+
End of File
+--+------+
|: | CRLF |
The end of data is indicated by this tag. The end of line sequence+(LF-on+Unix systems, CRLF on PCs) follows this tag.
File Header
+--+--------+----------+
|0 | length | filename |
The optional start-of-file record begins with a tag character+('0')-and-a-12-character file header. The first four characters are the count
(in hex) of the 16-bit data word values (B) which follow, not including data byte values (*). The remaining file header characters are the
name of the file and may be any ASCII characters, blank padded.
Checksum
+--+---+---+---+---+
|7 | n | n | n | n |
The checksum is the 2s complement sum of the 8-bit ASCII values-of-characters, beginning with the first tag character and ending with the
checksum tag character (7). The nnnn is 16-bit big-endian hexadecimal.
Dummy Checksum
+--+---+---+---+---+
|8 | n | n | n | n |
The checksum is the 2s complement sum of the 8-bit ASCII values+of-characters,-beginning with the first tag character and ending with the
checksum tag character (8). The nnnn is 16-bit big-endian hexadecimal.
Address
+--+---+---+---+---+
|9 | n | n | n | n |
Addresses may be given for any data byte, but none is mandatory.--The-file+begins at 0000 if no address is given before the first data
field. The nnnn is 16-bit big-endian hexadecimal.
Data Word
+--+---+---+---+---+
|B | a | a | b | b |
Two bytes of data. The aa and bb are each 8-bit big-endian hexadecimal.---+---+
End of Record
+--+------+
|F | CRLF |
The end of line sequence (LF on Unix systems, CRLF on PCs) is escaped-using this tag. The checksum is reset to zero at this point.
Program Identifier
+--+---+---+---+---+------+
|K | n | n | n | n | text |
The program identifier can contain a brief description of-the-program,-or-can-be-empty (i.e. the text portion is optional). The nnnn
length (hex) of the field includes the `K', the length and the text; it is at least 5.
Size Multiplier
In general, binary data will expand in sized by approximately 2.9 times when represented with this format.
EXAMPLE
Here is an example TI-Tagged file. It contains the data "Hello, World[rq] to be loaded at address 0x0100.
K000590080B4865B6C6CB6F2CB2057B6F72B6C64*0A7F641F
:
Here is another example from the reference below
00028 7FDCFF
90000BFFFFBFFFFBFFFFBFFFFBFFFFBFFFFBFFFFBFFFF7F400F
90008BFFFFBFFFFBFFFFBFFFFBFFFFBFFFFBFFFFBFFFF7F3F8F
90010BFFFFBFFFFBFFFFBFFFFBFFFFBFFFFBFFFFBFFFF7F3FFF
90018BFFFFBFFFFBFFFFBFFFFBFFFFBFFFFBFFFFBFFFF7F3F7F
90020BFFFFBFFFFBFFFFBFFFFBFFFFBFFFFBFFFFBFFFF7F3FEF
:
SEE ALSO
http://www.dataio.com/pdf/Manuals/Unifamily/981-0014-016.pdf (page 6-7)
COPYRIGHT
srec_cat version 1.58
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Peter Miller
The srec_cat program comes with ABSOLUTELY NO WARRANTY; for details use the 'srec_cat -VERSion License' command. This is free software and
you are welcome to redistribute it under certain conditions; for details use the 'srec_cat -VERSion License' command.
AUTHOR
Peter Miller E-Mail: pmiller@opensource.org.au
//* WWW: http://miller.emu.id.au/pmiller/
Reference Manual SRecord srec_ti_tagged_16(5)