back to list

Editing Scala seq files

🔗Gene Ward Smith <gwsmith@svpal.org>

5/8/2005 9:50:58 AM

I'm constantly doing the same edit commands on Scala seq files to turn
them into a form other programs can work with. I'd like to automate
this process by making it into a script in a batch file.
Unfortunately, the only editor in Windows I know of with command line
capability is edlin, which is 25 years old and famous for how
pathetically weak it is, and I don't see how to make it work.

Does anyone know of a command line capable text editor for Windows
that isn't brain-damaged, or have an alternative suggestion for how to
do this?

🔗Gene Ward Smith <gwsmith@svpal.org>

5/8/2005 10:15:54 AM

--- In tuning@yahoogroups.com, "Gene Ward Smith" <gwsmith@s...> wrote:

> Does anyone know of a command line capable text editor for Windows
> that isn't brain-damaged, or have an alternative suggestion for how to
> do this?

So far as alternative methods go, I thought about learning Perl to do
this, but suspect the time I lose learning it will be greater than the
time I save using it. But maybe not...any Perl programmers who would
care to comment?

🔗Carl Lumma <ekin@lumma.org>

5/8/2005 12:05:54 PM

>I'm constantly doing the same edit commands on Scala seq files to turn
>them into a form other programs can work with. I'd like to automate
>this process by making it into a script in a batch file.
>Unfortunately, the only editor in Windows I know of with command line
>capability is edlin, which is 25 years old and famous for how
>pathetically weak it is, and I don't see how to make it work.
>
>Does anyone know of a command line capable text editor for Windows
>that isn't brain-damaged, or have an alternative suggestion for how to
>do this?

I thought you already did this kind of thing in Maple. XEmacs and
Vim are both available for Windows. A little googling would no
doubt reveal an embarrassment of riches.

-Carl

🔗Carl Lumma <ekin@lumma.org>

5/8/2005 12:08:16 PM

>> Does anyone know of a command line capable text editor for Windows
>> that isn't brain-damaged, or have an alternative suggestion for how to
>> do this?
>
>So far as alternative methods go, I thought about learning Perl to do
>this, but suspect the time I lose learning it will be greater than the
>time I save using it. But maybe not...any Perl programmers who would
>care to comment?

Programmers are not known for recommending against learning their
language. I'd recommend Python over Perl.

-Carl

🔗Torsten Anders <t.anders@qub.ac.uk>

5/8/2005 12:38:28 PM

On Sun, 2005-05-08 at 12:08 -0700, Carl Lumma wrote:
> >> Does anyone know of a command line capable text editor for Windows
> >> that isn't brain-damaged, or have an alternative suggestion for how to
> >> do this?
> >
> >So far as alternative methods go, I thought about learning Perl to do
> >this, but suspect the time I lose learning it will be greater than the
> >time I save using it. But maybe not...any Perl programmers who would
> >care to comment?
>
> Programmers are not known for recommending against learning their
> language. I'd recommend Python over Perl.

;-)

Anyway, you may want to learn only as much as necessary. I am certainly
convinced that Python would be a good option, but perhaps sed (stream
editor) already does the job. This is an old UNIX application which has
been ported to other systems.

Advantage: you avoid learning a full programming language -- sed is
exactly designed for this kind of task.

Disadvantage: the usage is perhaps more cryptic.

Best,
Torsten

--
Torsten Anders
Sonic Arts Research Centre
Queen's University Belfast
Tel: +44 28 9097 4761 (office)
+44 28 9066 7439 (private)
www.torsten-anders.de

🔗Yahya Abdal-Aziz <yahya@melbpc.org.au>

5/9/2005 7:07:25 AM

Gene,

-----Original Message-----
You wrote:
> I'm constantly doing the same edit commands on Scala seq files to turn
> them into a form other programs can work with. I'd like to automate
> this process by making it into a script in a batch file.
> Unfortunately, the only editor in Windows I know of with command line
> capability is edlin, which is 25 years old and famous for how
> pathetically weak it is, and I don't see how to make it work.
>
> Does anyone know of a command line capable text editor for Windows
> that isn't brain-damaged, or have an alternative suggestion for how to
> do this?

Let me ask: why do you need command-line capability?
What results will you achieve with that ability that you
won't get with a windowing editor?

These days, if I wish to apply similar transforms to a number of
text files, I simply do them once in Word, recording a macro as
I do so. I then assign the macro to a new button in Word. Then
whenever I want to process another file in future, I open it in
Word and press the button.

Mind you, I haven't a clue how to make Word's Replace function
operate on grep-like regular expressions, but I suspect it's
possible by writing a little VBA code for a macro to execute.

Anyway, if you have Word available - or OpenOffice, or
StarOffice - consider this kind of approach.

I, too, use Python, but only in a limited way, for some custom
graphics programming. Had a look at Perl, and ran away
screaming! I'm not that much of a glutton for punishment.
I've had my fill of arcane (too-clever) programming and editing
syntax over the last few decades ...

If you've got a handle on sed, I'd say go with it, for quick and
reliable results. I'd guess (haven't checked) that there'd be
a usable sed in Cygwin, which sort of qualifies as a Window
solution.

Regards,
Yahya

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 6/5/05

🔗Gene Ward Smith <gwsmith@svpal.org>

5/9/2005 12:55:15 PM

--- In tuning@yahoogroups.com, "Yahya Abdal-Aziz" <yahya@m...> wrote:

> These days, if I wish to apply similar transforms to a number of
> text files, I simply do them once in Word, recording a macro as
> I do so. I then assign the macro to a new button in Word. Then
> whenever I want to process another file in future, I open it in
> Word and press the button.

This is a little strange, but it might work. How complicated can a
macro get?

> I, too, use Python, but only in a limited way, for some custom
> graphics programming. Had a look at Perl, and ran away
> screaming! I'm not that much of a glutton for punishment.
> I've had my fill of arcane (too-clever) programming and editing
> syntax over the last few decades ...

I thought Perl was supposed to be pretty easy to learn. :(

> If you've got a handle on sed, I'd say go with it, for quick and
> reliable results.

I don't have a handle on anything, or I wouldn't have this problem.

🔗Gene Ward Smith <gwsmith@svpal.org>

5/9/2005 4:11:22 PM

Can anyone who knows sed explain why this batch file doesn't do anything?

c:\Program Files\GnuWin32\bin\sed.exe -e '1,$s/Beethoven/Brahms/'
c:\Maple\sed\insed c:\Maple\sed\outsed

🔗Gene Ward Smith <gwsmith@svpal.org>

5/9/2005 1:57:16 PM

--- In tuning@yahoogroups.com, Torsten Anders <t.anders@q...> wrote:

> Anyway, you may want to learn only as much as necessary. I am certainly
> convinced that Python would be a good option, but perhaps sed (stream
> editor) already does the job. This is an old UNIX application which has
> been ported to other systems.
>
> Advantage: you avoid learning a full programming language -- sed is
> exactly designed for this kind of task.
>
> Disadvantage: the usage is perhaps more cryptic.

I've downloaded it, and it looks perfect to me. I don't think it is
cryptic, since it is really just the old Unix command-line editors
converted to scripting. Since it seems to be widely available, I may
post scripts doing interesting things to Scala seq files.

🔗Guglielmo <gugliel@guglielmomusic.com>

5/10/2005 1:55:57 PM

In sed, the 's' command is for substitution: so it replaces the word Beethoven with the word Brahms -- could it be that there was no Beetheven to replace in source file 'insed'??

Guglielmo

Gene Ward Smith wrote:
> Can anyone who knows sed explain why this batch file doesn't do anything?
> > c:\Program Files\GnuWin32\bin\sed.exe -e '1,$s/Beethoven/Brahms/'
> c:\Maple\sed\insed c:\Maple\sed\outsed
> > > > > > You can configure your subscription by sending an empty email to one
> of these addresses (from the address at which you receive the list):
> tuning-subscribe@yahoogroups.com - join the tuning group.
> tuning-unsubscribe@yahoogroups.com - leave the group.
> tuning-nomail@yahoogroups.com - turn off mail from the group.
> tuning-digest@yahoogroups.com - set group to send daily digests.
> tuning-normal@yahoogroups.com - set group to send individual emails.
> tuning-help@yahoogroups.com - receive general help information.
> > Yahoo! Groups Links
> > > > > > >

🔗Gene Ward Smith <gwsmith@svpal.org>

5/10/2005 1:44:16 PM

--- In tuning@yahoogroups.com, Guglielmo <gugliel@g...> wrote:
> In sed, the 's' command is for substitution: so it replaces the word
> Beethoven with the word Brahms -- could it be that there was no
> Beetheven to replace in source file 'insed'??

No Beetheven, but there was Beethoven. :)

I take it you think this should have worked.

🔗Herman Miller <hmiller@IO.COM>

5/10/2005 6:16:17 PM

Gene Ward Smith wrote:
> Can anyone who knows sed explain why this batch file doesn't do anything?
> > c:\Program Files\GnuWin32\bin\sed.exe -e '1,$s/Beethoven/Brahms/'
> c:\Maple\sed\insed c:\Maple\sed\outsed

I didn't notice this at first, but it should be:

"c:\Program Files\GnuWin32\bin\sed.exe"

With quotes. Otherwise, it tries to run "c:\Program.exe"!

I really hate that annoying "Program Files" directory. Why did Microsoft have to put that stupid space there?!??!

🔗Gene Ward Smith <gwsmith@svpal.org>

5/10/2005 6:52:28 PM

--- In tuning@yahoogroups.com, Herman Miller <hmiller@I...> wrote:
> Gene Ward Smith wrote:

> I really hate that annoying "Program Files" directory. Why did
Microsoft
> have to put that stupid space there?!??!

For the same reason Microsoft did all the innumerable other dumb
things they did. I wish they'd used / instead of \, come to that.

🔗Gene Ward Smith <gwsmith@svpal.org>

5/10/2005 7:34:48 PM

--- In tuning@yahoogroups.com, Herman Miller <hmiller@I...> wrote:
> Gene Ward Smith wrote:
> > Can anyone who knows sed explain why this batch file doesn't do
anything?
> >
> > c:\Program Files\GnuWin32\bin\sed.exe -e '1,$s/Beethoven/Brahms/'
> > c:\Maple\sed\insed c:\Maple\sed\outsed
>
> I didn't notice this at first, but it should be:
>
> "c:\Program Files\GnuWin32\bin\sed.exe"

Good idea, but it didn't work. :(

🔗Yahya Abdal-Aziz <yahya@melbpc.org.au>

5/10/2005 7:36:20 PM

Gene,

You asked:
> How complicated can a [Microsoft Word] macro get?

Pretty much anything you can do directly in Word, once,
you can record and use straight away as a macro.

Then, if you're game, you can program a bit of Visual Basic
for Applications - VBA - to do just about anything that
Visual Basic can do. This is where I would think of doing
regular-expression manipulation.

Regards,
Yahya

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 6/5/05

🔗Kurt Bigler <kkb@breathsense.com>

5/10/2005 11:33:28 PM

on 5/10/05 7:34 PM, Gene Ward Smith <gwsmith@svpal.org> wrote:

> --- In tuning@yahoogroups.com, Herman Miller <hmiller@I...> wrote:
>> Gene Ward Smith wrote:
>>> Can anyone who knows sed explain why this batch file doesn't do
> anything?
>>>
>>> c:\Program Files\GnuWin32\bin\sed.exe -e '1,$s/Beethoven/Brahms/'
>>> c:\Maple\sed\insed c:\Maple\sed\outsed
>>
>> I didn't notice this at first, but it should be:
>>
>> "c:\Program Files\GnuWin32\bin\sed.exe"
>
> Good idea, but it didn't work. :(

You probably want to put the above directory in your PATH, and then you can
probably just type "sed".

I know how to do this on unix, but it is different on Windows. Maybe
somebody else can help on the details.

-Kurt

🔗Gene Ward Smith <gwsmith@svpal.org>

5/11/2005 12:16:20 AM

--- In tuning@yahoogroups.com, Kurt Bigler <kkb@b...> wrote:

> You probably want to put the above directory in your PATH, and then
you can
> probably just type "sed".

I tried putting all the files in the sed bin directory, and that
didn't work, so I don't think pathnames can be the problem. I'm hoping
Perl will work, since sed doesn't seem to want to.

🔗Graham Breed <gbreed@gmail.com>

5/11/2005 7:39:55 AM

Posting to tuning because the conversation's still here although it's
completely off topic

On 5/11/05, Gene Ward Smith <gwsmith@svpal.org> wrote:
> --- In tuning@yahoogroups.com, Herman Miller <hmiller@I...> wrote:
> > Gene Ward Smith wrote:
> > > Can anyone who knows sed explain why this batch file doesn't do
> anything?
> > >
> > > c:\Program Files\GnuWin32\bin\sed.exe -e '1,$s/Beethoven/Brahms/'
> > > c:\Maple\sed\insed c:\Maple\sed\outsed
> >
> > I didn't notice this at first, but it should be:
> >
> > "c:\Program Files\GnuWin32\bin\sed.exe"
>
> Good idea, but it didn't work. :(

Are you running using cmd.exe? Not having the quotes should have
given the error

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

There's something seriously wrong if you didn't get that.
Furthermore, you have to use "..." around your sed command, not '...'
and that should give you an error as well. You'll also get an error
if outsed doesn't exist. (Do you expect that to take the output? RTFM)

I'm guessing the batch file isn't being run at all. Possibly a
program with the same name is in the path ahead of it. Try running
straight from the command line before you assume it's a sed problem.

Graham

🔗Gene Ward Smith <gwsmith@svpal.org>

5/11/2005 11:43:10 AM

--- In tuning@yahoogroups.com, Graham Breed <gbreed@g...> wrote:

> I'm guessing the batch file isn't being run at all. Possibly a
> program with the same name is in the path ahead of it.

When I redirect the standard output I do get a blank file.

Try running
> straight from the command line before you assume it's a sed problem.

I did, of course, but can't figure out how to make it run from the
command line at all. I miss having a DOS prompt.

🔗Gene Ward Smith <gwsmith@svpal.org>

5/11/2005 2:08:27 PM

--- In tuning@yahoogroups.com, "Gene Ward Smith" <gwsmith@s...> wrote:

Following a suggestion by Carl Lumma, I used a version of sed called
"ssed" instead of Gnu sed; it worked perfectly the first time out of
the box. I would suggest other people wanting a Windows version of sed
and who experience problems try it.

🔗Yahya Abdal-Aziz <yahya@melbpc.org.au>

5/13/2005 12:49:22 AM

Gene,

I've been following your sed saga with puzzlement ... thanks
for your recommendation of ssed, which may help others
avoid similar pain.

> > Try running straight from the command line before
> > you assume it's a sed problem.
>
> I did, of course, but can't figure out how to make it run from the
> command line at all. I miss having a DOS prompt.
>
[YA] In any version of Windows I've used, there's always
been a command (or DOS) prompt available. If you're using
Windows XP, there's one available on the standard menu; also
you can download the "Command Prompt Here" Powertool
from Microsoft for free, which gives you a context menu
command to run a Command prompt in any folder.

> Following a suggestion by Carl Lumma, I used a version of sed called
> "ssed" instead of Gnu sed; it worked perfectly the first time out of
> the box. I would suggest other people wanting a Windows version of sed
> and who experience problems try it.

Regards,
Yahya

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 10/5/05