You can use printf:
Also, note that you need to change the 2 numbers in the regular expression to match the size of the preceding text and of the text you're replacing.
I have file format like below and I'm trying to modify this file.
I need to add 'ENDEND' end of each record.
01 ASH01 1CTCTL EDPPOO STAND
01 ASH08 0020 A1TH 101
01 ASH09 0022 A1TH 102
01 ASH09 0022 A1TH 103
01 ASH02 2CTCTL ... (5 Replies)
Hi All,
My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found..The issue is the last... (15 Replies)
Hi All,
My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found in the same file..The... (27 Replies)
Hi
I need to be search a file of fixed length records and when I hit a particular record that match a search string, substitute a known position field
In the example file below
FHEAD000000000120090806143011
THEAD0000000002Y0000000012 P00000000000000001234
TTAIL0000000003... (0 Replies)
Hi
I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall:
E.g: Actual File content:
Hello
Name: Nitin Raj
Welcome to Unix... (4 Replies)
Hi,
I have a file with multiple lines(fixed width dat file). I want to search for '02' in the positions 45-46 and if available, in that lines, I need to replace value in position 359 with blank. As I am new to unix, I am not able to figure out how to do this. Can you please help me to achieve... (9 Replies)
I have data coming in the below format for each record
<?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><testdetials>....</test_sox>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox... (8 Replies)
Discussion started by: dsravanam
8 Replies
9. Post Here to Contact Site Administrators and Moderators
In file, we have millions of records each of 1000 in length. And at specific position say 800 there is a space, we need to replace it with Character X if the ID in that row starts with 123.
So far i have used the below which is replacing space at that position to X but its not checking for... (3 Replies)
Hi All,
I have a file and it is a fixed length file. I want to move the values from 42,6 ( where 6 is length) to the 36th position
Original file:
00000100000100000100000100000100001 000870 ... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
LEARN ABOUT DEBIAN
srec_emon52
srec_emon52(5) File Formats Manual srec_emon52(5)NAME
srec_emon52 - Elektor Monitor (EMON52) file format
DESCRIPTION
This format is used by the monitor EMON52, developed by the European electronics magazine Elektor (Elektuur in Holland). Elektor wouldn't
be Elektor if they didn't try to reinvent the wheel. It's a mystery why they didn't use an existing format for the project. Only the
Elektor Assembler will produce this file format, reducing the choice of development tools dramatically.
Records
All data lines are called records, and each record contains the following four fields:
+---+------+---+-----------+------+
|cc | aaaa | : | dd ... dd | ssss |
The field are defined as follows: +---+------+---+-----------+------+
cc The byte count. A two digit hex value (1 byte), counting the actual data bytes in the record. The byte count is separated from
the next field by a space.
aaaa The address field. A four hex digit (2 byte) number representing the first address to be used by this record.
: The address field and the data field are separated by a colon.
dd The actual data of this record. There can be 1 to 255 data bytes per record (see cc) All bytes in the record are separated from
each other (and the checksum) by a space.
ssss Data Checksum, adding all bytes of the data line together, forming a 16 bit checksum. Covers only all the data bytes of this
record.
Please note that there is no End Of File record defined.
Byte Count
The byte count cc counts the actual data bytes in the current record. Usually records have 16 data bytes. I don't know what the maximum
number of data bytes is. It depends on the size of the data buffer in the EMON52.
Address Field
This is the address where the first data byte of the record should be stored. After storing that data byte, the address is incremented by
1 to point to the address for the next data byte of the record. And so on, until all data bytes are stored.
The address is represented by a 4 digit hex number (2 bytes), with the MSD first.
Data Field
The payload of the record is formed by the Data field. The number of data bytes expected is given by the Byte Count field.
Checksum
The checksum is a 16 bit result from adding all data bytes of the record together.
Size Multiplier
In general, binary data will expand in sized by approximately 3.8 times when represented with this format.
EXAMPLE
Here is an example of an EMON52 file:
10 0000:57 6F 77 21 20 44 69 64 20 79 6F 75 20 72 65 61 0564
10 0010:6C 6C 79 20 67 6F 20 74 68 72 6F 75 67 68 20 61 05E9
10 0020:6C 6C 20 74 68 69 73 20 74 72 6F 75 62 6C 65 20 05ED
10 0030:74 6F 20 72 65 61 64 20 74 68 69 73 20 73 74 72 05F0
04 0040:69 6E 67 21 015F
SEE ALSO
http://sbprojects.fol.nl/knowledge/fileformats/emon52.htm
AUTHOR
This man page was taken from the above Web page. It was written by San Bergmans <sanmail@bigfoot.com>
Reference Manual SRecord srec_emon52(5)