comp.lang.ada
 help / color / mirror / Atom feed
* programming question . . .
@ 2006-09-17 21:03 lakeoftea
  2006-09-17 23:12 ` Martin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: lakeoftea @ 2006-09-17 21:03 UTC (permalink / raw)


I'm trying to write a program that will look at a directory and take
the "_"'s out of all of the files and replace them with spaces.  this
seems like an easy program but i haven't used ada since freshman year
and i'm kind of stumped.  any ideas.  no this is not for an assignment
:)

thanks!




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

* Re: programming question . . .
  2006-09-17 21:03 programming question . . lakeoftea
@ 2006-09-17 23:12 ` Martin
  2006-09-18  6:48 ` Maciej Sobczak
  2006-09-23 19:22 ` Jacob Sparre Andersen
  2 siblings, 0 replies; 6+ messages in thread
From: Martin @ 2006-09-17 23:12 UTC (permalink / raw)


What compiler/OS are you using?

If you are using GNAT GPL "2005" or "2006" then it comes with
Ada.Directories which will help. For other compilers, try
http://www.martin.dowie.btinternet.co.uk/ and download a version of
Ada.Directories from there. There is a "rename" procedure in this
package.

You could look at using Ada.Strings.Maps for working out the new name
but it's probably overkill. Just loop over the range of the String
object and check/replace as required.

Cheers
-- Martin

lakeoftea wrote:
> I'm trying to write a program that will look at a directory and take
> the "_"'s out of all of the files and replace them with spaces.  this
> seems like an easy program but i haven't used ada since freshman year
> and i'm kind of stumped.  any ideas.  no this is not for an assignment
> :)
> 
> thanks!




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

* Re: programming question . . .
  2006-09-17 21:03 programming question . . lakeoftea
  2006-09-17 23:12 ` Martin
@ 2006-09-18  6:48 ` Maciej Sobczak
  2006-09-23 19:22 ` Jacob Sparre Andersen
  2 siblings, 0 replies; 6+ messages in thread
From: Maciej Sobczak @ 2006-09-18  6:48 UTC (permalink / raw)


lakeoftea wrote:
> I'm trying to write a program that will look at a directory and take
> the "_"'s out of all of the files and replace them with spaces.

Looks like a perfect job for Tcl/Bash/<your_favorite_script_engine>.


-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/



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

* Re: programming question . . .
  2006-09-17 21:03 programming question . . lakeoftea
  2006-09-17 23:12 ` Martin
  2006-09-18  6:48 ` Maciej Sobczak
@ 2006-09-23 19:22 ` Jacob Sparre Andersen
  2006-09-23 20:57   ` Dr. Adrian Wrigley
  2 siblings, 1 reply; 6+ messages in thread
From: Jacob Sparre Andersen @ 2006-09-23 19:22 UTC (permalink / raw)


"lakeoftea" <lakeoftea@gmail.com> writes:

> I'm trying to write a program that will look at a directory and take
> the "_"'s out of all of the files and replace them with spaces.
> this seems like an easy program but i haven't used ada since
> freshman year and i'm kind of stumped.  any ideas.  no this is not
> for an assignment :)

I wouldn't use Ada for this task.  On a well-equipped system, it can
be done with the command:

   perl -pe 's/_/ /g' *

Greetings,

Jacob
-- 
"The current state of knowledge can be summarised thus:
 In the beginning, there was nothing, which exploded."




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

* Re: programming question . . .
  2006-09-23 19:22 ` Jacob Sparre Andersen
@ 2006-09-23 20:57   ` Dr. Adrian Wrigley
  2006-09-25 10:28     ` Jacob Sparre Andersen
  0 siblings, 1 reply; 6+ messages in thread
From: Dr. Adrian Wrigley @ 2006-09-23 20:57 UTC (permalink / raw)


On Sat, 23 Sep 2006 21:22:27 +0200, Jacob Sparre Andersen wrote:

> "lakeoftea" <lakeoftea@gmail.com> writes:
> 
>> I'm trying to write a program that will look at a directory and take
>> the "_"'s out of all of the files and replace them with spaces.
>> this seems like an easy program but i haven't used ada since
>> freshman year and i'm kind of stumped.  any ideas.  no this is not
>> for an assignment :)
> 
> I wouldn't use Ada for this task.  On a well-equipped system, it can
> be done with the command:
> 
>    perl -pe 's/_/ /g' *

I was thinking about suggesting Perl, but perhaps:

perl -pie 's/_/ /g' *

might be more appropriate? (in-place editing of files)
--
Adrian




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

* Re: programming question . . .
  2006-09-23 20:57   ` Dr. Adrian Wrigley
@ 2006-09-25 10:28     ` Jacob Sparre Andersen
  0 siblings, 0 replies; 6+ messages in thread
From: Jacob Sparre Andersen @ 2006-09-25 10:28 UTC (permalink / raw)


Adrian Wrigley wrote:

> I was thinking about suggesting Perl, but perhaps:
>
> perl -pie 's/_/ /g' *
>
> might be more appropriate? (in-place editing of files)

Definitely!  My mistake.

Jacob
-- 
"Human beings just can't not communicate."



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

end of thread, other threads:[~2006-09-25 10:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-17 21:03 programming question . . lakeoftea
2006-09-17 23:12 ` Martin
2006-09-18  6:48 ` Maciej Sobczak
2006-09-23 19:22 ` Jacob Sparre Andersen
2006-09-23 20:57   ` Dr. Adrian Wrigley
2006-09-25 10:28     ` Jacob Sparre Andersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox