Re: [Freedos-devel] Question about edlin
Of course, quotes can be escaped. -- Gregory > On 01/22/2024 5:18 PM EST Bret Johnson via Freedos-devel > wrote: > > > That solves the problem with commas, but it looks like you may still have > issues if there are quotes in the file. > > I know one thing I've done in the past with some of my programs is allow the > use of either a double-quote ("), single-quote ('), or grave-quote (`) as > string demarkers, which allows strings to contain any two of the three > quote-types and still be able to identify them properly. Of course, it will > still fail if a string contains all three quote types, but that is a rare > situation. > > EDLIN's solution (at least for MS-DOS 7.1) solves all potential problems with > Ctrl-Z since Ctrl-Z (end-of-file) should never appear in the middle of the > kinds of files (plain text) that EDLIN works with. > > > ___ > Freedos-devel mailing list > Freedos-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/freedos-devel ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel
Re: [Freedos-devel] Question about edlin
That solves the problem with commas, but it looks like you may still have issues if there are quotes in the file. I know one thing I've done in the past with some of my programs is allow the use of either a double-quote ("), single-quote ('), or grave-quote (`) as string demarkers, which allows strings to contain any two of the three quote-types and still be able to identify them properly. Of course, it will still fail if a string contains all three quote types, but that is a rare situation. EDLIN's solution (at least for MS-DOS 7.1) solves all potential problems with Ctrl-Z since Ctrl-Z (end-of-file) should never appear in the middle of the kinds of files (plain text) that EDLIN works with. ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel
Re: [Freedos-devel] Question about edlin
On Mon, Jan 22, 2024 at 11:24 AM Gregory Pietsch via Freedos-devel wrote: > > FD edlin ignores a leading space. If you want the leading space to be > searched for, put the string in quotes; e.g. > > 1r"written"," written" > > The reason why I didn't stick a ^Z there is because I wanted to get > away from control characters in the commands, and a comma just looks > better, IMHO. > Ah - very helpful! That solves my problem. Thanks! Also can use the same trick to change a comma to something else. Here's another 1-line demo: *1p 1:*period, *1r",","." 1: period. If you can't see it well, that's a 'comma inside double quotes' then a comma, then a 'period inside double quotes.' But really it just needs the quotes about the comma, and only if it's the first comma. Here's an example to change it back again: *1r.,"," 1: period, *1r",",. 1: period. *1r.,, 1: period, That last one changes the period to a comma, and you don't need the double quotes around the second comma in this case. Jim ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel
Re: [Freedos-devel] Question about edlin
I haven't shipped the NLS stuff since version 2.20 or so because I thought Jerome was handling that. -- Gregory > On 01/22/2024 2:11 PM EST Wilhelm Spiegl via Freedos-devel > wrote: > > > It would be great when edlin could support the 20 NLS files that are shipped > with it some day. > At least 1.24 till 1.29 of the NLS files are not supported. And I do not > speak about Chinese. > > Willi > > > > > Sent: Monday, January 22, 2024 at 6:23 PM > From: "Gregory Pietsch via Freedos-devel" > > To: "Technical discussion and questions for FreeDOS developers." > > Cc: "Gregory Pietsch" > Subject: Re: [Freedos-devel] Question about edlin > > FD edlin ignores a leading space. If you want the leading space to be > searched for, put the string in quotes; e.g. > > 1r"written"," written" > > The reason why I didn't stick a ^Z there is because I wanted to get away from > control characters in the commands, and a comma just looks better, IMHO. > > Gregory > > > On 01/22/2024 12:06 PM EST Bret Johnson via Freedos-devel > > wrote: > > > > > > > I'm using the "r" (replace) instruction correctly: 1rfrom,to will > > > start at line 1 and replace "from" with "to". > > > > > > But it looks like a leading space is ignored, so edlin treats my > > > "1rwritten, written" as just "1rwritten,written" and seems to ignore > > > it because the "from" and "to" strings are the same. > > > > > > FYI: I can add a space in the middle of a replaced word, such as: > > > > > > *1rtext,te xt > > > 1: This is a plain te xt file,written in edlin. > > > > > > Is "ignore leading spaces after the comma in the 'r' command" the > > > expected behavior from MS-DOS edlin? > > > > I haven't used EDLIN in a LONG time (decades), but just did an experiment > > with MS-DOS 7.1 EDLIN. Your problem doesn't seem to be unrecognized spaces, > > it seems to be that you're not using any sort of "escape" character to > > separate your input and output strings. I believe you think the comma > > should be the "escape" character and it isn't. There's a similar issue with > > programs like SED and AWK/GAWK. > > > > When I'm in EDLIN (at least the one with comes with MD-SOD 7.1) and I type > > "?" to get help, the syntax for the Replace command looks like this: > > > > Replace [startline][,endline][?]R[oldtest][CTRL+Znewtest] > > > > It expects you to use a Ctrl-Z (end-of-file character) as the "escape" > > character. > > If I use the Ctrl-Z "trick" I can replace things like you're wanting to do. > > > > I do not remember if earlier versions of EDLIN did this or not, nor do I > > know how FD-EDLIN works. > > > > > > ___ > > Freedos-devel mailing list > > Freedos-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/freedos-devel > > > ___ > Freedos-devel mailing list > Freedos-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/freedos-devel > > ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel
Re: [Freedos-devel] Question about edlin
It would be great when edlin could support the 20 NLS files that are shipped with it some day. At least 1.24 till 1.29 of the NLS files are not supported. And I do not speak about Chinese. Willi Sent: Monday, January 22, 2024 at 6:23 PM From: "Gregory Pietsch via Freedos-devel" To: "Technical discussion and questions for FreeDOS developers." Cc: "Gregory Pietsch" Subject: Re: [Freedos-devel] Question about edlin FD edlin ignores a leading space. If you want the leading space to be searched for, put the string in quotes; e.g. 1r"written"," written" The reason why I didn't stick a ^Z there is because I wanted to get away from control characters in the commands, and a comma just looks better, IMHO. Gregory > On 01/22/2024 12:06 PM EST Bret Johnson via Freedos-devel wrote: > > > > I'm using the "r" (replace) instruction correctly: 1rfrom,to will > > start at line 1 and replace "from" with "to". > > > > But it looks like a leading space is ignored, so edlin treats my > > "1rwritten, written" as just "1rwritten,written" and seems to ignore > > it because the "from" and "to" strings are the same. > > > > FYI: I can add a space in the middle of a replaced word, such as: > > > > *1rtext,te xt > > 1: This is a plain te xt file,written in edlin. > > > > Is "ignore leading spaces after the comma in the 'r' command" the > > expected behavior from MS-DOS edlin? > > I haven't used EDLIN in a LONG time (decades), but just did an experiment with MS-DOS 7.1 EDLIN. Your problem doesn't seem to be unrecognized spaces, it seems to be that you're not using any sort of "escape" character to separate your input and output strings. I believe you think the comma should be the "escape" character and it isn't. There's a similar issue with programs like SED and AWK/GAWK. > > When I'm in EDLIN (at least the one with comes with MD-SOD 7.1) and I type "?" to get help, the syntax for the Replace command looks like this: > > Replace [startline][,endline][?]R[oldtest][CTRL+Znewtest] > > It expects you to use a Ctrl-Z (end-of-file character) as the "escape" character. > If I use the Ctrl-Z "trick" I can replace things like you're wanting to do. > > I do not remember if earlier versions of EDLIN did this or not, nor do I know how FD-EDLIN works. > > > ___ > Freedos-devel mailing list > Freedos-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/freedos-devel ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel
Re: [Freedos-devel] Question about edlin
FD edlin ignores a leading space. If you want the leading space to be searched for, put the string in quotes; e.g. 1r"written"," written" The reason why I didn't stick a ^Z there is because I wanted to get away from control characters in the commands, and a comma just looks better, IMHO. Gregory > On 01/22/2024 12:06 PM EST Bret Johnson via Freedos-devel > wrote: > > > > I'm using the "r" (replace) instruction correctly: 1rfrom,to will > > start at line 1 and replace "from" with "to". > > > > But it looks like a leading space is ignored, so edlin treats my > > "1rwritten, written" as just "1rwritten,written" and seems to ignore > > it because the "from" and "to" strings are the same. > > > > FYI: I can add a space in the middle of a replaced word, such as: > > > > *1rtext,te xt > > 1: This is a plain te xt file,written in edlin. > > > > Is "ignore leading spaces after the comma in the 'r' command" the > > expected behavior from MS-DOS edlin? > > I haven't used EDLIN in a LONG time (decades), but just did an experiment > with MS-DOS 7.1 EDLIN. Your problem doesn't seem to be unrecognized spaces, > it seems to be that you're not using any sort of "escape" character to > separate your input and output strings. I believe you think the comma should > be the "escape" character and it isn't. There's a similar issue with > programs like SED and AWK/GAWK. > > When I'm in EDLIN (at least the one with comes with MD-SOD 7.1) and I type > "?" to get help, the syntax for the Replace command looks like this: > > Replace [startline][,endline][?]R[oldtest][CTRL+Znewtest] > > It expects you to use a Ctrl-Z (end-of-file character) as the "escape" > character. > If I use the Ctrl-Z "trick" I can replace things like you're wanting to do. > > I do not remember if earlier versions of EDLIN did this or not, nor do I know > how FD-EDLIN works. > > > ___ > Freedos-devel mailing list > Freedos-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/freedos-devel ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel
Re: [Freedos-devel] Question about edlin
> I'm using the "r" (replace) instruction correctly: 1rfrom,to will > start at line 1 and replace "from" with "to". > > But it looks like a leading space is ignored, so edlin treats my > "1rwritten, written" as just "1rwritten,written" and seems to ignore > it because the "from" and "to" strings are the same. > > FYI: I can add a space in the middle of a replaced word, such as: > > *1rtext,te xt > 1: This is a plain te xt file,written in edlin. > > Is "ignore leading spaces after the comma in the 'r' command" the > expected behavior from MS-DOS edlin? I haven't used EDLIN in a LONG time (decades), but just did an experiment with MS-DOS 7.1 EDLIN. Your problem doesn't seem to be unrecognized spaces, it seems to be that you're not using any sort of "escape" character to separate your input and output strings. I believe you think the comma should be the "escape" character and it isn't. There's a similar issue with programs like SED and AWK/GAWK. When I'm in EDLIN (at least the one with comes with MD-SOD 7.1) and I type "?" to get help, the syntax for the Replace command looks like this: Replace [startline][,endline][?]R[oldtest][CTRL+Znewtest] It expects you to use a Ctrl-Z (end-of-file character) as the "escape" character. If I use the Ctrl-Z "trick" I can replace things like you're wanting to do. I do not remember if earlier versions of EDLIN did this or not, nor do I know how FD-EDLIN works. ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel
[Freedos-devel] Question about edlin
I actually do use edlin sometimes. But I have a question that might actually be a bug report: When I try to search and replace text, and I want to add a space in front of my replaced text, I can't get it to work. Am I doing this wrong? Here's an example: In this 1-line file, I want to edit the line from "..file,written.." to "..file, written.." (I want to add a space before the word "written") D:\DOCS>edlin t.txt edlin 2.23, copyright (c) 2003 Gregory Pietsch This program comes with ABSOLUTELY NO WARRANTY. It is free software, and you are welcome to redistribute it under the terms of the GNU General Public License -- either version 2 of the license, or, at your option, any later version. t.txt: New file. *i : This is a plain text file,written in edlin. : . *1rwritten, written *l 1:*This is a plain text file,written in edlin. * I'm using the "r" (replace) instruction correctly: 1rfrom,to will start at line 1 and replace "from" with "to". But it looks like a leading space is ignored, so edlin treats my "1rwritten, written" as just "1rwritten,written" and seems to ignore it because the "from" and "to" strings are the same. FYI: I can add a space in the middle of a replaced word, such as: *1rtext,te xt 1: This is a plain te xt file,written in edlin. Is "ignore leading spaces after the comma in the 'r' command" the expected behavior from MS-DOS edlin? ___ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel