bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to print a "line feed" without "carriage return" ?


From: Aharon Robbins
Subject: Re: How to print a "line feed" without "carriage return" ?
Date: Fri, 26 Aug 2005 14:34:20 +0300

Greetings. Re this:

> Date: Fri, 26 Aug 2005 11:45:22 +0200
> From: "Vollmer, Manfred" <address@hidden>
> Subject: How to print a "line feed" without "carriage return" ?
> To: address@hidden
>
>
> Hello,
>
> it seems to be impossible to print a simple line feed "\x0A" ; gawk
> always inserts a "\x0D" in front of it.
>
> My test program is the following batch file:
>
> C:\GnuWin32\bin\gawk "BEGIN { print \"X\x0AYZ\" >\"Test.txt\" }"
>
> The result is a file with (Hex-Dump):
>
> 58 0D 0A 59 5A 0D 0A                               X..YZ..
>
>    ^^
>
> =0D
>
> How to avoid the 0D ???  (I want to use gawk to prepare text files for
> an import into EXCEL.)

You can try

        printf "X\x0AYZ\n"

which doesn't use print.

Alternatively, you can try

        BEGIN { BINMODE = 2 }

which forces output to be in binary mode, and then use printf.

> My gawk version is 3.1.3, I run it under Windows XP professional.

My sympathies.

> Another problem is, that (when printing numbers) the decimal point is
> printed as comma. How to force gawk to print the decimal point correctly
> as point?

This has to do with your locale. You could try setting the environment
variable LC_ALL to the value "C" (no quotes) and see if that helps.

> Thank you for your help.
>
> Manfred Vollmer

You're welcome.

Good luck,

Arnold




reply via email to

[Prev in Thread] Current Thread [Next in Thread]