From mboxrd@z Thu Jan 1 00:00:00 1970 From: will.senn@gmail.com (Will Senn) Date: Mon, 6 Nov 2017 23:00:03 -0600 Subject: [TUHS] Literal character escapes in v7 In-Reply-To: References: <201711070434.vA74YlrN020951@freefriends.org> Message-ID: <1eee3597-4b32-0153-26de-87a973892b07@gmail.com> On 11/6/17 10:49 PM, Will Senn wrote: > On 11/6/17 10:34 PM, arnold at skeeve.com wrote: >> Will Senn wrote: >> >>> I'm not looking for code review, but the code is intended to replace >>> the >>> tabs and backspaces with \t and \b respectively, but I haven't been >>> able >>> to test it because I can't seem to make a backspace character appear in >>> input. In later unices, ^V followed by the backspace would work, but >>> that's not part of v7. Backspace itself is my erase character, so >>> anytime I just type it, it backspaces :). >>     awk 'BEGIN { print "a\bc\td" ; exit }' | your-program >> >> Enjoy, >> >> Arnold >> >> P.S. The exit is needed for V7 awk, IIRC, not modern ones. > > This is a good idea, but... Here's my results from just running awk > for \t, \n, and \b: > > $ awk 'BEGIN { print "a\tb" ; exit }'; > a       b > $ awk 'BEGIN { print "a\nb" ; exit }' > anb > $ awk 'BEGIN { print "a\bb" ; exit }' > abb > $ > > Strange. It looks like it's just ignoring the backslash in the case of > \n and \b. > > Will > I wrote a c program to print a string in line with the suggestion to use awk and my code worked, but it's still odd that the above didn't work. Will -- GPG Fingerprint: 68F4 B3BD 1730 555A 4462 7D45 3EAA 5B6D A982 BAAF