- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to read a data file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2004 07:19 PM
11-29-2004 07:19 PM
How to read a data file
Urgent help please
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2004 07:21 PM
11-29-2004 07:21 PM
Re: How to read a data file
Pipe to more if you prefer.
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2004 08:39 PM
11-29-2004 08:39 PM
Re: How to read a data file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2004 08:49 PM
11-29-2004 08:49 PM
Re: How to read a data file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2004 09:07 PM
11-29-2004 09:07 PM
Re: How to read a data file
What program did generate this file ?
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2004 09:13 PM
11-29-2004 09:13 PM
Re: How to read a data file
using the command more mydile the result is
M-4M-^AM-GM-^
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2004 09:17 PM
11-29-2004 09:17 PM
Re: How to read a data file
Yes... I need to read the raw data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2004 09:23 PM
11-29-2004 09:23 PM
Re: How to read a data file
"od -cx file" outputs your file, combining hexa and ascii output.
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2004 03:32 PM
11-30-2004 03:32 PM
Re: How to read a data file
0000000 264 201 307 200 001 022 203 \b d @ # 021 2 005 t 371
b481 c780 112 8308 6440 2311 3205 74f9
0000020 245 006 200 004 254 026 002 3 206 001 \0 207 001 001 210 002
a506 8004 ac16 233 8601 87 101 8802
0000040 I 211 002 \0 \a 212 005 \0 320 V a N 253 006 200
2049 8902 7 8a05 d0 5661 4eab 680
But the format I want is :-
Raw Data:
0 H' A081EA80 01128101 00820100 83086400 27080900
20 H' 20308408 64002708 09000000 A5068004 0A6E0703
40 H' 86010087 01018802 25218902 000B8A02 00CBAB06
60 H' 80040A6E 070E8C0D 48554157 45492E43 4F4D2E43
Any help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2004 03:40 PM
11-30-2004 03:40 PM
Re: How to read a data file
od -A x -t x1 -v infile > outfile
Another very good tool available for download from any of HP-UX Porting Centre's is "hexedit". It will display the data quite well and if you like you can modify as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2004 04:20 PM
11-30-2004 04:20 PM
Re: How to read a data file
---- dump.pl ----
$file = shift @ARGV or die "Please provide file to split and # chunks";
open (FILE, "<$file") or die "Error opening $file";
binmode (FILE);
$offset = 0;
$block = 20;
while ($block == read(FILE, $buffer, $block)){
printf ("%d H'%08X %08X %08X %08X %08X\n", $offset, unpack("L5",$buffer));
$offset += $block;
}
------------ usage -----
$ perl dump.pl dump.pl | head -5
0 H'2466696C 65203D20 73686966 74204041 52475620
20 H'6F722064 69652022 506C6561 73652070 726F7669
40 H'64652066 696C6520 746F2073 706C6974 20616E64
60 H'20232063 68756E6B 73223B0A 6F70656E 20284649
80 H'4C452C20 223C2466 696C6522 29206F72 20646965
----------- note -----
1) Hex dump, DEcimal offsets?
2) Left to right or Right to left?
3) Little-Endian or Big-Endian?
Check out: http://www.perldoc.com/perl5.8.4/pod/func/pack.html
Enjoy!
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2004 04:44 PM
11-30-2004 04:44 PM
Re: How to read a data file
Can you make your code more clear I am not a perl programmer:
I excuted the code and getting the following error:-
syntex error in file dump.pl at line 1.next tokens "ARGV myfile"
Excution of dump.pl aborted due to comilation errors.
Thands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2004 05:01 PM
11-30-2004 05:01 PM
Re: How to read a data file
strings
Regards,
Isralyn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2004 05:23 PM
11-30-2004 05:23 PM
Re: How to read a data file
Sounds like a cut and paste error.
Maybe a line-wrap? Try again?
You did not re-type did you? Never do that! Only cut & paste. Not for lazyness but for correctness!
Looks like you might have judging by the 'syntex' in your reply. Surely the system said 'syntax' no?
That first line is actually accidently too line (my cut and paste!)
----- put all of this in a file: dump.pl ----
$file = shift @ARGV or die "Provide input file name";
open (FILE, "<$file") or die "Error opening $file";
binmode (FILE);
$offset = 0;
$block = 20;
while ($block == read(FILE, $buffer, $block)){
printf ("%d H'%08X %08X %08X %08X %08X\n", $offset, unpack("L5",$buffer));
$offset += $block;
}
------ end of dump.pl ----
Now provide that file to perl as argument:
perl dump.pl
A little explanation.
- the first line just picks up a first argument and remembers it in variable $file.
- next, try to open that file
- switch to binary mode
- initialize offset and size params.
- read a block, into buffer variable. THis returns the number of bytes read. Processing continutes while that is the same as the number of bytes requests.
- the printf is where the real magic happens in the argument list. We don't give a list of 5 variables as 'usual' but the result from an 'unpack' which is a list of 5 values.
- The unpack argument "L5" tell the system to interpret the 20 bytes read as 5 times a 32-bit integer (see perl online doc!).
Try again!
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2004 05:42 PM
11-30-2004 05:42 PM
Re: How to read a data file
Thanks for you support
Yes i did cut and paste from begining and i am still getting the error now is:
syntax error in file dump.pl at line 1, next 2 tokens "@ARGV or"
syntax error in file dump.pl at line 2, next 2 tokens ")or"
Excution of dump.pl aborted due to compilation errors.
I am using 10.20 OS.I have attached the binary file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2004 07:40 PM
11-30-2004 07:40 PM
Re: How to read a data file
It worked fine.....