10-23-2011
How to convert file in Unix
we have a file that shows encoding as small-endian (in NotePad+). I can not read this file in my program. If I change it to ANSI (again in Notepad+) and save it, I am able to read it in my program.
Can I use the iconv function to change this file to ANSI ?
Thanks in advance for your help.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
I have a print control file (dflt) for Oracle which is in binary. As I am going to develope an application in Window environment, I would like to reference the dflt file. But it is in binary format and I cannot access it. Anyone can suggest me how to convert the file into text or... (5 Replies)
Discussion started by: user12345
5 Replies
2. UNIX for Dummies Questions & Answers
Hi, I know nothing about Unix. Recently received image files from a client. Mac sees it as a Unix executable file. How do I convert these files to Tiff?
Thanks for helping. (1 Reply)
Discussion started by: Pet Teoh
1 Replies
3. Shell Programming and Scripting
Hi Friends,
I have a .log file generated from a tool(Windows PC) which can be opened using a notepad, but when I tried to view the file in unix (cygwin on my laptop) the file type is showing as binary file, So I am unable to process the file.
I need to extract some of the selected text... (3 Replies)
Discussion started by: ks_reddy
3 Replies
4. Shell Programming and Scripting
Hi
I have a excel file in unix machine and have to convert it into a .csv file.I have to do this from a unix script.How do we do this?
Thanks
Abhinav (3 Replies)
Discussion started by: akashtcs
3 Replies
5. Shell Programming and Scripting
Hi,
We have a couple of ms excel files in unix server.We need convert the excel files to files TAB limiter format file with using unix script.
Could you please advise on this (2 Replies)
Discussion started by: koti_rama
2 Replies
6. Shell Programming and Scripting
All,
I have several *.dat files which is created in windows (ANSI Endoing) Or PC File format, once I copy those files to unix.
How can I convert those file to utf8 encoding ?
I tired iconv, it says not supported
Please help
Thanks
- S (5 Replies)
Discussion started by: Shanks
5 Replies
7. Shell Programming and Scripting
Dear Users , Need to convert delimited text files in UNix server to an Excel file and move the excel file to Windows environment. Am trying to automate the whole process. Can anyone share the ideas,if they have done similar ones before...Thanks -Meera (1 Reply)
Discussion started by: meerakrish
1 Replies
8. UNIX for Advanced & Expert Users
we have a CSV which i need to convert to XML using Perl or Unix shell scripting.
I was able to build this XML in oracle database. However, SQL/XML query is running for long time. Hence, I'm considering to write a Perl or shell script to generate this XML file. Basically need to build this XML... (3 Replies)
Discussion started by: laknar
3 Replies
9. Shell Programming and Scripting
Hello I have a file : file1.txt with the below contents :
237176 test1 test2 1442149024
237138 test3 test4 1442121300
237171 test5 test7 1442112823
237145 test9 test10 1442109600
In the above file fourth field represents the timestamp in Unix format.
I found a command which converts... (6 Replies)
Discussion started by: rahul2662
6 Replies
10. Shell Programming and Scripting
I have input data looks like this which is a part of a csv file
7,1265,76548,"0102:04"
8,1266,76545,"0112:04"
I need to make the output data should look like this and the output data will be part of text file:
7|1265000 |7654899 |A|
8|12660000 |76545999 |B|
The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies
ENDIAN(3) Linux Programmer's Manual ENDIAN(3)
NAME
htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh - convert values between host
and big-/little-endian byte order
SYNOPSIS
#define _BSD_SOURCE
#include <endian.h>
uint16_t htobe16(uint16_t host_16bits);
uint16_t htole16(uint16_t host_16bits);
uint16_t be16toh(uint16_t big_endian_16bits);
uint16_t le16toh(uint16_t little_endian_16bits);
uint32_t htobe32(uint32_t host_32bits);
uint32_t htole32(uint32_t host_32bits);
uint32_t be32toh(uint32_t big_endian_32bits);
uint32_t le32toh(uint32_t little_endian_32bits);
uint64_t htobe64(uint64_t host_64bits);
uint64_t htole64(uint64_t host_64bits);
uint64_t be64toh(uint64_t big_endian_64bits);
uint64_t le64toh(uint64_t little_endian_64bits);
DESCRIPTION
These functions convert the byte encoding of integer values from the byte order that the current CPU (the "host") uses, to and from little-
endian and big-endian byte order.
The number, nn, in the name of each function indicates the size of integer handled by the function, either 16, 32, or 64 bits.
The functions with names of the form "htobenn" convert from host byte order to big-endian order.
The functions with names of the form "htolenn" convert from host byte order to little-endian order.
The functions with names of the form "benntoh" convert from big-endian order to host byte order.
The functions with names of the form "lenntoh" convert from little-endian order to host byte order.
VERSIONS
These function were added to glibc in version 2.9.
CONFORMING TO
These functions are nonstandard. Similar functions are present on the BSDs, where the required header file is <sys/endian.h> instead of
<endian.h>. Unfortunately, NetBSD, FreeBSD, and glibc haven't followed the original OpenBSD naming convention for these functions, whereby
the nn component always appears at the end of the function name (thus, for example, in NetBSD, FreeBSD, and glibc, the equivalent of OpenB-
SDs "betoh32" is "be32toh").
NOTES
These functions are similar to the older byteorder(3) family of functions. For example, be32toh() is identical to ntohl().
The advantage of the byteorder(3) functions is that they are standard functions available on all Unix systems. On the other hand, the fact
that they were designed for use in the context of TCP/IP means that they lack the 64-bit and little-endian variants described in this page.
EXAMPLE
The program below display the results of converting an integer from host byte order to both little-endian and big-endian byte order. Since
host byte order is either little-endian or big-endian, only one of these conversions will have an effect. When we run this program on a
little-endian system such as x86-32, we see the following:
$ ./a.out
x.u32 = 0x44332211
htole32(x.u32) = 0x44332211
htobe32(x.u32) = 0x11223344
Program source
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
union {
uint32_t u32;
uint8_t arr[4];
} x;
x.arr[0] = 0x11; /* Lowest-address byte */
x.arr[1] = 0x22;
x.arr[2] = 0x33;
x.arr[3] = 0x44; /* Highest-address byte */
printf("x.u32 = 0x%x
", x.u32);
printf("htole32(x.u32) = 0x%x
", htole32(x.u32));
printf("htobe32(x.u32) = 0x%x
", htobe32(x.u32));
exit(EXIT_SUCCESS);
}
SEE ALSO
byteorder(3)
COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU
2009-01-19 ENDIAN(3)