9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: kalterdev@gmail.com
To: 9fans <9fans@9fans.net>
Subject: [9fans] How do you deal with newlines (line feed, LF, \n) in filenames?
Date: Sat, 10 Aug 2024 16:46:56 -0400	[thread overview]
Message-ID: <17233228160.1d47.67930@composer.9fans.topicbox.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

Suppose you want to grep over a filtered list of files. Is there an idiomatic approach to solve this problem with rc?

I can only think of one erroneous method:

grep pattern `{find . -type f -name '*_test.go'}

I know that it's possible to use find(1)'s -exec option. But find does not exist in Plan 9.

It seems like it is impossible to solve this problem with simple IO pipes. One must encode newlines somehow, be it C-style \n, shell-style 'string', JSON or whatnot.

It also seems that newlines are the only symbol that breaks the idiom `grep pattern `{cmd}`.
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T11149f1f949593f5-M80e746fe9ffc98e7d9511774
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1464 bytes --]

             reply	other threads:[~2024-08-10 20:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-10 20:46 kalterdev [this message]
2024-08-10 21:05 ` sirjofri
2024-08-10 21:32 ` [9fans] " kalterdev
2024-08-10 21:48   ` sirjofri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17233228160.1d47.67930@composer.9fans.topicbox.com \
    --to=kalterdev@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).