9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] How do you deal with newlines (line feed, LF, \n) in filenames?
@ 2024-08-10 20:46 kalterdev
  2024-08-10 21:05 ` sirjofri
  2024-08-10 21:32 ` [9fans] " kalterdev
  0 siblings, 2 replies; 4+ messages in thread
From: kalterdev @ 2024-08-10 20:46 UTC (permalink / raw)
  To: 9fans

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-10 21:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-10 20:46 [9fans] How do you deal with newlines (line feed, LF, \n) in filenames? kalterdev
2024-08-10 21:05 ` sirjofri
2024-08-10 21:32 ` [9fans] " kalterdev
2024-08-10 21:48   ` sirjofri

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).