Re: head and file with CR line terminators

2023-12-26 Thread Michael Cook
If you know the file has CR line terminators, e.g.: $ file foo foo: ASCII text, with CR line terminators $ cat -A foo hello^Mworld^Mone fish^Mtwo fish^M$ $ we can use the swiss army knife tool `perl` to show the first line: $ perl -pe 'BEGIN { $/ = "\r"; $\ = "\n" } chomp; print; exit' wrote:

Re: head and file with CR line terminators

2023-12-26 Thread Michael Cook
Beware, printing carriage returns to your terminal will tend to result in puzzling output. Best to pipe the output to `cat -A` to see what is actually being printed. On Tue, Dec 26, 2023 at 12:27 PM Fred H Olson wrote: > I forgot to mention. I am using version 8.5 of coreutils on old > Ubuntu 16

Re: 'Cat' feature request

2023-12-27 Thread Michael Cook
> > If Bash had macros, we could do things like this in better ways. > Imagine we could do this: A Bash function could use `history 1` to see exactly what was typed on the command line. And then do its own parsing. function foo { bar "$(history 1)" } That's a little hacky because Bash is go

patch: touch --verbose

2021-04-07 Thread Michael Cook
Attached, please find a patch to add the --verbose (-v) option to the touch command. As for rm, cp, ln, etc. Michael From 00338cbd9d16d632a55b70ba9fdeeca5710f6a5a Mon Sep 17 00:00:00 2001 From: Michael Cook Date: Wed, 7 Apr 2021 16:00:47 -0400 Subject: [PATCH] touch: Add --verbose (-v) option

Re: patch: touch --verbose

2021-04-07 Thread Michael Cook
da* > > > > On Wednesday, April 7, 2021, 5:31:43 p.m. EDT, Michael Cook < > mich...@waxrat.com> wrote: > > > Attached, please find a patch to add the --verbose (-v) option to the touch > command. > As for rm, cp, ln, etc. > > Michael >

Re: patch: touch --verbose

2021-04-09 Thread Michael Cook
olutions show what we'd *like* to happen, what we're going to try to make happen, but they're much more optimistic than the proposed patch at indicating what actually happened. Michael On Thu, Apr 8, 2021 at 7:23 PM Bernhard Voelker wrote: > On 4/7/21 10:11 PM, Michael Cook w

Re: chown new option

2022-05-27 Thread Michael Cook
Maybe you just want to use `find`? Something like: find \ /LVM/MONITORAMENTO/CARROS/CARRO-381*/$DATA*/*/* \ /LVM/MONITORAMENTO/CARROS/CARRO-380*/$DATA*/*/* \ ... \ -maxdepth 1 ! -type d -exec chown root:root -v {} \; On Fri, May 27, 2022 at 8:51 AM Maxsuel Marcelino wrote: > chown needs and a

Re: csplit reports No space left on device

2022-08-18 Thread Michael Cook
The relevant failure is here: openat(AT_FDCWD, "zz_17876563", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOSPC (No space left on device) The failed syscalls regarding LC_MESSAGES are when the code is trying to generate an error message regarding the failed openat call. They aren't the cause of the

Re: [PATCH] basenc: Paddingless input/output for base64url

2022-08-19 Thread Michael Cook
+base64url_decode_ctx_wrapper_no_padding (struct base_decode_context *ctx, + char const *restrict in, idx_t inlen, + char *restrict out, idx_t *outlen) +{ +bool b = base64url_decode_ctx_wrapper(ctx, in, inlen, out, outlen); +if (!b &

Re: [PATCH] basenc: Paddingless input/output for base64url

2022-08-23 Thread Michael Cook
+ int to_write = BASE_LENGTH (sum); + base_encode (inbuf, sum, outbuf, to_write); + if (without_padding) + { +while (*(outbuf+to_write-1) == '=') +{ +--to_write; +} + } Probably should make sure `to_wr

Re: [PATCH] fold: Add '-c' (cut) option to cut off lines at a specific WIDTH

2023-02-11 Thread Michael Cook
FWIW, we can do that with sed. Here's an example to crop at 50 chars (this example uses perl to generate two lines of different lengths). $ perl -le 'print "a" x 40; print "a" x 80' | sed -E 's/^(.{50}).+/\1.../' aa

Re: Cant get tr command to generate ROT5 or simple gematria

2023-04-28 Thread Michael Cook
For "47" there's no "7" in tr's first argument "0-4". So, tr is going to leave the "7" unchanged (but will change the "4" to "9") resulting in the output "97". Looks like you want `tr 0-9 5-90-4`? On Fri, Apr 28, 2023 at 1:29 AM wrote: > So I can't understand why I can't get tr to output ROT5:

Re: mkdir access folder flag

2023-08-02 Thread Michael Cook
That would need to be a shell function (or the like). Otherwise, when the `mkdir` process finishes, any chdir it did would have had no effect on the parent process (e.g., your shell). Something like this: # create a directory and chdir into it function mkcd { mkdir -pv "$@" && eval cd \"\$$#\"; }