I want to split/parse certain bits of the hex data into another field.
Example:
Input data is
Word1: 4f72abfd
Output:
Parse bits (5 to 0) into field word1data1=0x00cd=205 decimal
Parse bits (7 to 6) into field word1data2=0x000c=12 decimal
etc.
Word2: efff3d02
Parse bits (13 to 3) into field word2data1=0x0f40=3904 decimal
Parse bits (16 to 14) into field word2data2=0x0004=4 decimal
etc.
The bits that are parsed from each input word is different for all 8 input hex words.
I have the following INPUT hex file (input.txt):
# line is a comment
Code:
% 30105 3 5 3 1 1 -- this line is used as a tag
4f72abfd
efff3d02
353b3212
ffff9299
22222222
2299330a
9abe8f12
930d9d2d
# line is a comment
% 30105 3 5 3 1 1 -- this line is used as a tag
3572aaff
820f9283
ffff9299
22222222
2299330a
9abe8f12
930d9d2d
... and so on and so forth
I would like the OUTPUT to look like this (output.txt):
Code:
# line is a comment
% 30105 3 5 3 1 1 -- this line is used as a tag
4f72abfd word1field1=0x00cd=205, word1data2=0x000c=12, word1da#=...
efff3d02 word2field1=0x0f40=3904 , word2data2=0x0004=4, word2da#=...
353b3212 word3field1=..., word3field2=..., etc.
ffff9299 word4field1=..., word4field2=..., etc.
22222222 word5field1=..., word5field2=..., etc.
2299330a word6field1=..., word6field2=..., etc.
9abe8f12 word7field1=..., word7field2=..., etc.
930d9d2d word8field1=..., word8field2=..., etc.
# line is a comment
% 30105 3 5 3 1 1 -- this line is used as a tag
3572aaff word1field1=..., word1data2=..., word1data#=...
820f9283 word2field1=..., word2data2=..., word2data#=...
ffff9299
22222222
2299330a
9abe8f12
930d9d2d word8data1=..., word8data2=..., word8data#=...
Well, as you read the character data, you must substring and convert from hex in character to integer, before you "and" '&' to extract bits. hex - perldoc.perl.org
Hello,
I am working parsing a large input file1(field CFA)
I have to compare the the file1 field(CFA byte 88-96) with the content of the file2(It contains only one field) and and insert rows equal
in another file.
Here is my code and sample input file:
... (7 Replies)
The below awk parser works for most data inputs, but I am having trouble with the last one. The problem is in the below rules steps 1 and 2 come from $2 (NC_000013.10:g.20763686_20763687delinsA) and steps 3 and 4 come from $1 (NM_004004.5:c.34_35delGGinsT).
Parse Rules:
The header is... (0 Replies)
I have an input file attached that I am trying to parse in tab-delimanted format:
The chromosomal variant column contains all the information:
parse rules:
1. 4 zeros after the NC_ and the digits before the .
2. digits after the g. repeated twice separated by a tab
3. letter before the >
4.... (10 Replies)
I have 32 bit value in hex that I want to separate into fields and then convert the fields into decimal values.
Input file has 2 words of 32 bit hex values:
000001ac
ca85210e
Output both words separated into individual bit fields:
ca85210e: f1(31:9), f2(8:0)
f7c392ac: f1(31:14),... (2 Replies)
Hi,
I have the file like this:
#Contents of file 1 are:
Dec 10 12:33:44 User1 Interface: Probe
Dec 10 12:33:47 uSER1 SOME DATA
Dec 10 12:33:47 user1 Interface: MSGETYPE
Dec 10 12:34:48 user1 ID: 10.
Dec 10 12:33:55 user1 Interface: MSGTYPE
Dec 10 12:33:55 user1 Id: 9
... (1 Reply)
I'm trying to find all modules that contain line feed characters. It shows up at ^M (Hex 0D0A). Does anyone know how to do a search for hex fields?
I tried doing "egrep ^M *.cbl", but that doesn't work.
Thanks! (3 Replies)
#!/bin/bash
i=0
cat 1.csv | while read fileline
do
echo "$fileline"
IFS="#" flds=( $fileline )
nrofflds=${#flds}
echo "noof fields$nrofflds"
fld=0
while
do
echo "noof counter$fld"
echo "$nrofflds"
#fld1="${flds}" trying to store the content of line to fields but i... (4 Replies)
Folks,
I have a bit of an issue trying to obtain some data from a csv file using PERL. I can sort the file and remove any duplicates leaving only 4 or 5 rows containing data. My problem is that the data contained in the original file contains a lot more columns and when I try ro run this script... (13 Replies)
Am not able to display the corresponding character for the hex value using the format specifier into a file
Could you please help me with that
>cat other
a|\xc2\xbo
>cat write.pl
#! /opt/third-party/bin/perl
open(FILE2, "< other") || die "Unable to open file other\n";
while (... (7 Replies)