Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Replacing spaces characters with % character
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
contracer  
View profile  
 More options Feb 8, 7:54 am
Newsgroups: comp.unix.shell
From: contracer <contrace...@gmail.com>
Date: Wed, 8 Feb 2012 04:54:29 -0800 (PST)
Local: Wed, Feb 8 2012 7:54 am
Subject: Replacing spaces characters with % character
Hi,
How could I replace all spaces in a file with % character, usind "for"
loop ?
Thanks

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pk  
View profile  
 More options Feb 8, 8:04 am
Newsgroups: comp.unix.shell
From: pk <p...@pk.invalid>
Date: Wed, 8 Feb 2012 14:04:27 +0100
Local: Wed, Feb 8 2012 8:04 am
Subject: Re: Replacing spaces characters with % character
On Wed, 8 Feb 2012 04:54:29 -0800 (PST), contracer <contrace...@gmail.com>
wrote:

> Hi,
> How could I replace all spaces in a file with % character, usind "for"
> loop ?

Obviously not, the for loop itself isn't used to replace characters. Why do
you need to use a for loop?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
contracer  
View profile  
 More options Feb 8, 8:45 am
Newsgroups: comp.unix.shell
From: contracer <contrace...@gmail.com>
Date: Wed, 8 Feb 2012 05:45:06 -0800 (PST)
Local: Wed, Feb 8 2012 8:45 am
Subject: Re: Replacing spaces characters with % character
On 8 fev, 11:04, pk <p...@pk.invalid> wrote:

> On Wed, 8 Feb 2012 04:54:29 -0800 (PST), contracer <contrace...@gmail.com>
> wrote:

> > Hi,
> > How could I replace all spaces in a file with % character, usind "for"
> > loop ?

> Obviously not, the for loop itself isn't used to replace characters. Why do
> you need to use a for loop?

Which Unix command could I use to verify character by character in a
file ?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Janis Papanagnou  
View profile  
 More options Feb 8, 9:00 am
Newsgroups: comp.unix.shell
From: Janis Papanagnou <janis_papanag...@hotmail.com>
Date: Wed, 08 Feb 2012 15:00:58 +0100
Local: Wed, Feb 8 2012 9:00 am
Subject: Re: Replacing spaces characters with % character
Am 08.02.2012 14:45, schrieb contracer:

> On 8 fev, 11:04, pk<p...@pk.invalid>  wrote:
>> On Wed, 8 Feb 2012 04:54:29 -0800 (PST), contracer<contrace...@gmail.com>
>> wrote:

>>> Hi,
>>> How could I replace all spaces in a file with % character, usind "for"
>>> loop ?

>> Obviously not, the for loop itself isn't used to replace characters. Why do
>> you need to use a for loop?

> Which Unix command could I use to verify character by character in a
> file ?

tr(1)

Janis


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aragorn  
View profile  
 More options Feb 8, 9:01 am
Newsgroups: comp.unix.shell
Followup-To: comp.unix.shell
From: Aragorn <stry...@telenet.be.invalid>
Date: Wed, 08 Feb 2012 15:01:20 +0100
Local: Wed, Feb 8 2012 9:01 am
Subject: Re: Replacing spaces characters with % character
On Wednesday 08 February 2012 14:45, contracer conveyed the following to
comp.unix.shell...

> On 8 fev, 11:04, pk <p...@pk.invalid> wrote:

>> On Wed, 8 Feb 2012 04:54:29 -0800 (PST), contracer wrote:

>> > How could I replace all spaces in a file with % character, usind
>> > "for" loop ?

>> Obviously not, the for loop itself isn't used to replace characters.
>> Why do you need to use a for loop?

> Which Unix command could I use to verify character by character in a
> file ?

        man sed

--
= Aragorn =
(registered GNU/Linux user #223157)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ed Morton  
View profile  
 More options Feb 8, 9:08 am
Newsgroups: comp.unix.shell
From: Ed Morton <mortons...@gmail.com>
Date: Wed, 08 Feb 2012 08:08:03 -0600
Local: Wed, Feb 8 2012 9:08 am
Subject: Re: Replacing spaces characters with % character
On 2/8/2012 7:45 AM, contracer wrote:

> On 8 fev, 11:04, pk<p...@pk.invalid>  wrote:
>> On Wed, 8 Feb 2012 04:54:29 -0800 (PST), contracer<contrace...@gmail.com>
>> wrote:

>>> Hi,
>>> How could I replace all spaces in a file with % character, usind "for"
>>> loop ?

>> Obviously not, the for loop itself isn't used to replace characters. Why do
>> you need to use a for loop?

> Which Unix command could I use to verify character by character in a
> file ?

It's not clear if you're talking about replacing spaces in a file name or in a
files contents, if you're issue is how to do the replacement in 1 file or if you
know how to do it for 1 file but can't figure out how to do it for many files.

You could really stand to post some sample input and expected output so we're
not all guessing.

      Ed.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Janis Papanagnou  
View profile  
 More options Feb 8, 9:15 am
Newsgroups: comp.unix.shell
From: Janis Papanagnou <janis_papanag...@hotmail.com>
Date: Wed, 08 Feb 2012 15:15:34 +0100
Local: Wed, Feb 8 2012 9:15 am
Subject: Re: Replacing spaces characters with % character
Am 08.02.2012 15:08, schrieb Ed Morton:

> On 2/8/2012 7:45 AM, contracer wrote:
>> [...]
> [...]>
> You could really stand to post some sample input and expected output so
> we're not all guessing.

As long as we're able to post just 5 or 6 character as response the
wasted time is not that that significant. ;-)

Janis


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bsh  
View profile  
 More options Feb 14, 6:48 pm
Newsgroups: comp.unix.shell
From: bsh <brian_hi...@rocketmail.com>
Date: Tue, 14 Feb 2012 15:48:20 -0800 (PST)
Local: Tues, Feb 14 2012 6:48 pm
Subject: Re: Replacing spaces characters with % character
On Feb 8, 4:54 am, contracer <contrace...@gmail.com> wrote:

> How could I replace all spaces in a file with % character, usind "for" loop ?

Why does it necessarily have to use the "for" loop; isn't the looping
flow-of-control code up to you and your particular implementation?
(Actually, the "while" or "until" loop should be more pertainent....)

Are you talking about percent encoding? (Probably not). This
code fragment should show more light on the technique:

From the Kornshell FAQ at http://kornshell.com/doc/faq.html:

Q25. How can I convert %XX values to ascii?
A25. You can convert this to a sequence of ANSI C strings and
then eval that string, for example suppose the variable 'foo' contains
%XX strings, then:

eval print -r -- "\$'${foo//'%'@(??)/'\x\1"'\$'"}'"

... will print out the string in ascii.

The above uses ksh version 1993 or newer features. If you want
a CGI / URL encoding/unencoding function in shell, there are many
to be found, including one from the author of kornshell:

http://www2.research.att.com/~gsf/download/ksh/scripts/cgi-lib.ksh
http://www2.research.att.com/~gsf/download/ksh/scripts/dump-cgi.ksh

... and others:

ftp://ftp.armory.com/pub/lib/ksh/cgi
http://cgd.sdf-eu.org/a/libs/sh/cgi.sh
http://www.mtxia.com/fancyIndex/Tools/Scripts/Korn/Functions/cgiparse.{html,shtml,txt}

=Brian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »