[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Is there a way to print a character in the escaped form?
From: |
david kerns |
Subject: |
Re: [bug-gawk] Is there a way to print a character in the escaped form? |
Date: |
Tue, 22 Jan 2019 14:15:30 -0700 |
On Tue, Jan 22, 2019 at 2:04 PM Peng Yu <address@hidden> wrote:
> Hi,
>
> I don't find a way to print '\t' as '\t' literally. Is there a way to
> do so? Thanks.
>
> awk -v x='\t' -e 'BEGIN { printf("%s\n", x) }'
>
> --
> Regards,
> Peng
>
>
this worked for me: (I entered 2 lines after the command)
$ awk '{gsub("\t", "\\t", $0); print }'
a a
a\ta
a b c
a\tb\tc