× 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.



I can report good progress in my little script to insert lines into an xml
file in the IFS.

I'm coming round to the view that I don't really care about the interactive
form of the SED command. My thinking was that it would be quicker to test
there before putting it in a script and in the program, as I often do now
with SQL before putting it in an SQLRPGLE program, but unlike SQL, which
you can literally just cut and paste into your program, SED seems to need
substantial alteration between the two modes, so I'll just make little test
stream files and little test scripts to test things from now on.

OK, so far I'm successfully inserting "/$start" (without the quotes) as the
first record and modifying a row count using the 's'ubstitute flag. My
script looks like this:

1i \
/$start
s/RowCount="2"/RowCount="30000"/

All of this is designed to remove the manual steps described in this
page: Serving
Up Spreadsheets <https://www.itjungle.com/2008/08/13/fhg081308-story01/>

Yes, I know it's an ancient technique, but it fits with work I've already
done with sending .csv files by email, so that's what I'm going with. I'll
post the relevant CL once I've finished and tidied it up.

Now I just have one thing left to do (or two nearly identical things), and
that is to insert the "/$line" and "/$end" records. This is very similar to
putting "/$start" at the beginning, and I thought it would be easy, but now
that I look at it again, in both cases the place where they need to go is
between "</Row>" and "<Row>" records, which don't make unique anchors to
insert before or after.

So, the next Exciting Challenge is to find out if I can go back or forward
a number of records from some distinctive string before inserting.


On Tue, Oct 13, 2020 at 11:11 AM Arnie Flangehead <
arnie.flangehead@xxxxxxxxx> wrote:

Hi, thanks for your further advice. I must be doing something wrong
because I can't get the inline method to work.

cat infile.txt |sed '/^ONE IS NICE$/i TWO IS NICER' > outfile.txt

sed: 001-2263 Error in file "/^ONE IS NICE$/i TWO IS ..." on line 1:
command i expects a backslash followed by text.
$

sed '/^ONE IS NICE$/i TWO IS NICER' < infile.txt

sed: 001-2263 Error in file "/^ONE IS NICE$/i TWO IS ..." on line 1:
command i expects a backslash followed by text.
$




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.