× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



http://www.natural-innovations.com/computing/asciiebcdic.html

the chart is your friend;)


----- Original Message -----
From: Aaron Bartell
To: 'Midrange Systems Technical Discussion'
Sent: Monday, November 19, 2007 7:58 PM
Subject: RE: Using sed to replace all instances with a hex value


Thanks for your efforts Brian, but the whole reason I am doing this is so I
can automate it in a program. With that said I can't use the <Enter> key,
and is why I was trying to get the \n escape sequence to work.

I am going to read over that link you provided to see what it turns up.

Thanks,
Aaron Bartell
http://mowyourlawn.com

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Brian Johnson
Sent: Monday, November 19, 2007 5:16 PM
To: Midrange Systems Technical Discussion
Subject: Re: Using sed to replace all instances with a hex value

While escape can be used in search arguments, replacement strings have to
use literal new-line characters. Here's an illustration:

The contents of file orig:

> cat orig
Now is the time for all good men to come to the aid of their country.


A two-line sed command (press Enter after the trailing '\' on the first
line) to add new-line before each "i":

> sed 's:i:\
>
> i:g' orig > sedd
$


And the result in file sedd:

> cat sedd
Now
is the t
ime for all good men to come to the a
id of the
ir country.


I, too, an a just learning about sed. Here's a link to a helpful document:

http://www.grymoire.com/Unix/Sed.html


On Nov 19, 2007 4:37 PM, Grizzly Malchow <grizzlym@xxxxxxxxxxxxxxxxxxxxx>
wrote:

> Aaron,
> I intentionally added the extra back slash. I read the following line at
> the information center:
>
> Each \n (new-line character) inside Text must have an additional \
> character before it (\\n).
>
> My interpretation of that is that I needed to add an additional slash to
> the replacement string.
>
> Here's the link I was looking at.
> http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/com.ib
> m.aix.genprogc/doc/genprogc/manip_strings_sed.htm
>
> I honestly don't know the first think about sed, but that was just
> something I came across. I figured it was worth a try.
>
> -----Original Message-----
> From: midrange-l-bounces+grizzlym=northernwholesale.com@xxxxxxxxxxxx
> [mailto:midrange-l-bounces+grizzlym=northernwholesale.com@xxxxxxxxxxxx]
> On Behalf Of Aaron Bartell
> Sent: Monday, November 19, 2007 4:01 PM
> To: 'Midrange Systems Technical Discussion'
> Subject: RE: Using sed to replace all instances with a hex value
>
> I believe you have one to many back slashes in there. Try the
> following:
>
> sed 's/i/\n/g' /home/grizzly/file1.txt > /home/grizzly/file2.txt
>
> I am guessing it will simply do an 'n' vs. '\n' in the resulting text,
> but
> thought I would point that out.
>
> Thanks for your response,
> Aaron Bartell
> http://mowyourlawn.com
>
>
> -----Original Message-----
> From: midrange-l-bounces@xxxxxxxxxxxx
> [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Grizzly Malchow
> Sent: Monday, November 19, 2007 3:59 PM
> To: Midrange Systems Technical Discussion
> Subject: RE: Using sed to replace all instances with a hex value
>
> Aaron,
> I had the same results as you did. I am also at V5R3. We installed a
> cume back in June that I believe put us up to date in regards to PTF's.
>
> I tried:
> sed 's/i/\\n/g' /home/grizzly/file1.txt > /home/grizzly/file2.txt
> and the results were as follows:
>
> Th\ns \ns a test to see \nf a new l\nne w\nll be created for each t\nme
> the letter \n \ns found.
>
> This replaced i with \n but it doesn't seem to insert a new line.
>
> -----Original Message-----
> From: midrange-l-bounces@xxxxxxxxxxxx
> [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Aaron Bartell
> Sent: Monday, November 19, 2007 3:09 PM
> To: 'Midrange Systems Technical Discussion'
> Subject: RE: Using sed to replace all instances with a hex value
>
> I think I may have not relayed my problem well enough. My problem is
> that
> the new line (i.e. \n) isn't working - or any excaped character for that
> matter.
>
> For example, given the following content in /home/aaron/file1.txt:
> -----------------------------------------------
> This is a test to see if a new line will be created for each time the
> letter
> i is found.
> -----------------------------------------------
>
> Now I run the following sed statement:
> sed 's/i/\n/g' /home/aaron/file1.txt > /home/aaron/file2.txt
>
> file2.txt now contains:
> -----------------------------------------------
> Thns ns a test to see nf a new lnne wnll be created for each tnme the
> letter
> n ns found.
> -----------------------------------------------
>
> Note how it simply replaced all letter 'i' instances with 'n' instead of
> creating a new line like it should have. Can somebody else run the same
> on
> their system to see if I may need to load some PTF's? Note that I
> looked
> for PTF's at Fix Central, but found none for sed.
>
> I am at V5R3.
>
> Thanks,
> Aaron Bartell
> http://mowyourlawn.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.