9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] /bin/split
@ 2000-10-19  0:23 arisawa
  0 siblings, 0 replies; 2+ messages in thread
From: arisawa @ 2000-10-19  0:23 UTC (permalink / raw)
  To: 9fans

Hello,

The command
	split -e expression file
produces files that are hard to understand to me.

What is intended by -e option ?

For example, let be samp:
	----- samp ---
	From alice
	abc
	defg
	From bob
	hijk
	lmn
	--------------

Command
	split -e '^From' samp
split samp into two. OK, this is reasonable.

But
	split -e 'From' samp
split samp into 6 files with only one line.

Kenji Arisawa
E-mail: arisawa@aichi-u.ac.jp



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

* Re: [9fans] /bin/split
@ 2000-10-20 12:55 rob pike
  0 siblings, 0 replies; 2+ messages in thread
From: rob pike @ 2000-10-20 12:55 UTC (permalink / raw)
  To: 9fans

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

Wow... split.  I haven't run that command in a long long time.
It has an unitialized variable. add a call to memset after
/sys/src/cmd/split.c:75:

			Resub match[2];
			memset(match, 0, sizeof match);	/* add this line */
			line[Blinelen(b)-1] = 0;

This fixes your example, anyway.

-rob


[-- Attachment #2: Type: message/rfc822, Size: 1520 bytes --]

From: arisawa@ar.aichi-u.ac.jp
To: 9fans@nx.aichi-u.ac.jp
Subject: [9fans] /bin/split
Date: Thu, 19 Oct 100 09:23:29 +0900
Message-ID: <20001020103912.AA63A199E7@mail>

Hello,

The command
	split -e expression file
produces files that are hard to understand to me.

What is intended by -e option ?

For example, let be samp:
	----- samp ---
	From alice
	abc
	defg
	From bob
	hijk
	lmn
	--------------

Command
	split -e '^From' samp
split samp into two. OK, this is reasonable.

But
	split -e 'From' samp
split samp into 6 files with only one line.

Kenji Arisawa
E-mail: arisawa@aichi-u.ac.jp

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

end of thread, other threads:[~2000-10-20 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-19  0:23 [9fans] /bin/split arisawa
2000-10-20 12:55 rob pike

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