On 26-Feb-2007, at 17:12, After Hours wrote:
I'm a fan of terminal much as the next person, but I've never found split or csplit to function as expected in Tiger. The above command doesn't function as expected.

Ah, it doesn't with the default OS X included split. I must have been in the terminal on my freeBSD machine where split has a -p option:

man split:
     -p pattern
The file is split whenever an input line matches pattern, which is interpreted as an extended regular expression. The matching line will be the first line of the next output file. This option
             is incompatible with the -b and -l options.

Maybe there is source for this split floating about?

<http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/split/split.c>

Has source code that doesn't match up with the version of split on my freebsd machine, as it does not include the -p option.

58.8.0.0-58.8.255.255 ; ADSL HuaweiBB Truehisp TH
58.18.0.0-58.18.255.255 ; CNCGROUP Neimeng Province CN
558.224.0.0-58.239.255.255 ; Hananet KR
59.0.0.0-59.31.255.255 ; kornet KR
59.144.34.0-59.144.34.255 ; Bharti infotel Ltd IN
59.188.0.0-59.188.255.255 ; New World Telecom HK
60.220.0.0-60.223.255.255 ; CNCGROUP Shanxi CN
61.0.0.0-61.1.255.255 ; BSNLNET IN
61.16.198.192-61.16.198.255 ; HOTWIRE IN
61.32.0.0-61.43.255.255 ; DACOM BORANET KR
222.32.0.0-222.63.255.255 ; CHINA RAILWAY TELECOMM CN
222.76.0.0-222.84.255.255 ; CHINANET fujian Xinjiang Guangxi province CN

one would think using csplit -k -f ickyIP_ sapmmyIP '/\r/' should split these at the line breaks, but it only works once. I may have parameters and arguments mucked up -- someone please point it out if so.

the drawback to csplit is you have to give it a count:

# csplit -f icky_ temp.txt '/$/' {11}

or, you could do

csplit -k -f icky_ temp.txt '/$/' {9999}

which while it will error out, will also work

(eliminate the -k though and the error will prevent the split files being created)



--
"Whose motorcycle is this?" "It's a chopper, baby."
"Whose chopper is this?" "It's Zed's."
"Who's Zed?" "Zed's dead, baby. Zed's dead."


--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to