« first day (3699 days earlier)      last day (55 days later) » 

1:53 PM
@thanasisp just a heads up: users are allowed to have multiple accounts, as long as they don't use these accounts to do things they couldn't do with a single account. So, if they vote for the other account's posts, or accept their answers or any other interaction, that's against the rules. But simply having multiple accounts isn't a problem.
 
2:24 PM
I want to ask an opinionated question
 
emacs vs vi ?
 
neither
 
:(
 
I often find myself writing csv output doing something like: printf '%s,%s,%s,%s,%s\n' "$stuff" ....
I know I can also just do: printf '%s,' "$unlimited" "$number" "$of" "$things" | sed 's/,$//'; echo
But there has to be a better way
actually I guess the echo there is unnecessary, sed appears to automatically add the newline
 
 
1 hour later…
3:42 PM
@jesse_b It doesn't add it, it just doesn't replace it:
$ printf 'foo\n' | sed 's/$/a/'
fooa
$ printf 'foo\n' | perl -pe 's/$/a/'
fooa
$ printf 'foo\n' | perl -pe 's/\n/a/'
fooa$
 
@terdon Well I'm not adding a newline in my printf command
cannot reproduce on ubuntu though
{0}:[100%]:[~/tmp]:[2020-11-24T15:31:34Z]
$ printf 'foo,'
foo,{0}:[100%]:[~/tmp]:[2020-11-24T15:44:23Z]
$ printf 'foo,' | sed 's/,$//'
foo
{0}:[100%]:[~/tmp]:[2020-11-24T15:44:29Z]
$
BSD sed
 
huh
I can't reproduce on arch either:
terdon@tpad ~ $ printf 'foo' | sed 's/,$//'
footerdon@tpad ~ $
 
hah I read that as foot erdon
> BSD sed: always appends a newline on output, even if the input line doesn't end in one.
 
I think there’s a Q&A about that somewhere on the main site
 
4:05 PM
@jesse_b ah!
 
BSD likes to be weird
hides from kusalananda
 
 
2 hours later…
5:39 PM
@jesse_b Checking this and it appears to not be true on OpenBSD.
It is however how sed on macOS (and therefore presumably on FreeBSD) works.
 
Only a few days ago I learned that lines end in linefeeds as per POSIX
Guess that explains such weirdnesses. I started from vi not making trailing linefeeds obvious
 
5:55 PM
@Kusalananda :)
@Kusalananda Do you know what version openbsd has? I think the version on my mac is from 2005
 
6:22 PM
@jesse_b It's difficult to talk about "versions" of tools that are maintained as part of the base system.
... as they're are never released/distributed separately.
I don't even know whether the sed on OpenBSD has the same lineage as the one on macOS/FreeBSD. I will check the CVS history... Hold on...
Ok, the OpenBSD sed was inherited from NetBSD in 1995.
The FreeBSD implementation comes from BSD 4.4 Lite.
And looking at the NetBSD sources, it's the same ancestor code.
So it's all the same basic sed implementation that has diverged within the various BSD projects.
 
keep bsd weird
 

« first day (3699 days earlier)      last day (55 days later) »