Ed Morton wrote:
> On 9/18/2012 9:23 AM, Thomas 'PointedEars' Lahn wrote:
>> Ed Morton wrote:
>>> On 9/18/2012 4:37 AM, Thomas 'PointedEars' Lahn wrote:
>>>> Ed Morton wrote:
>>>>> Thomas 'PointedEars' Lahn <
Point...@web.de> wrote:
>>> <snip>
>>>> But *first*, in <
news:201209111...@webuse.net>, you recommended
>>>> to use awk. You have been insisting to use awk in that subtread ever
>>>> since.
>>>>
>>>> Only *after* I posted a shell-only solution and Chris F.A. Johnson
>>>> disputed your unfounded statement there, you conceded that it could be
>>>> done in the shell.
>>>>
>>>> Why?
>>> Nonsense, read the thread again as you're confusing 2 very different
>>> things. I advocated using awk for non-trivial text processing
>>> applications but using a shell construct if you just want to tweak a
>>> string in the middle of a shell script. I never once advocated doing
>>> something like echoing a string to awk to modify the string and then
>>> reading the result back into a variable as you're suggesting I did.
>> That is correct; you actually suggested creating from the string value a
>> text file to be processed by awk instead, which is even more illogical
>> than piping the string echo into awk, or using shell built-ins instead.
>> And you called that "a working solution", showing that you did not
>> understand the OP's problem correctly in the first place.
>
> What the heck are you talking about "creating from the string value a text
> file to be processed by awk"???
See below.
> Also, the OP specifically posted that the awk script solved his problem
> (see below) so I think that's a pretty good indication that i did
> understand it.
No, it is pretty good indication that the OP thought that, as you were
resorting to awk immediately, there were no other possibilities,
particularly none with only the shell. Which they made clear in their other
followup (see below). Are you simply not paying attention, or whom are you
trying to fool here?
> Here's exactly what I said in the posts I think you're referring to:
>
> #On 9/11/2012 12:28 PM, Ed Morton wrote:
> # Carlo Zanziba <zanzib...@NOSPAMlibero.it> wrote:
> #
> #> Hello,
> #>
> #> Suppose I have such string
> #>
> #> str="first. second; third. lost? maybe! no"
> #> […]
So they have a string value in a sh-based shell (which, as it turned out, is
bash). And they want to transform that string:
| I'd want to turn every first character, and every non-blank character
| after dot, question and exclamative marks to capital, so that it turns to
|
| First. Second; third. Lost? Maybe! No
A plain and simple problem. From which in your solution, out of thin air,
it emerges a text file containing the string value …
> # $ cat file
> # first. second; third. "the prince of arabia" lost? maybe! no
… that you can process with awk then, of course:
> # $ cat tst.awk
> # BEGIN{ FS="" }
> # {
> […]
> and here's the OPs final response to the thread:
>
> #On 9/13/2012 2:02 AM, Carlo Zanziba wrote:
> # Il 12/09/2012 12:21, Ed Morton ha scritto:
> #> On 9/12/2012 1:13 AM, Carlo Zanziba wrote:
> #>> Thanks everybody. I was afraid my supposition was too far from
> #>> what bash could
> #>> give me.
> #>>
> #>> In any case, I appreciated your efforts.
> #>
> #> You did see that I gave you a working solution, right?
> #
> # Sure. It works, and fast!
> […]
Of course it works in certain situations. Nobody doubted that. The problem
that you still fail to see lies elsewhere: If all you know is a hammer,
every problem looks like a nail.
> Are you confusing my responses with someone else's? I don't recall seeing
> an alternative shell-builtin-only solution posted by you or anyone else
> but if you have one then please do share, otherwise just stop whining as
> you're really making no sense trying to attribute statements to me that I
> never made and complaining about perfectly reasonable working solutions,
> especially when no alternative has been posted.
Here it comes:
| From: Carlo Zanziba <zanzib...@NOSPAMlibero.it>
| Newsgroups: comp.unix.shell
| Subject: Re: Pattern matching within ,, and ^^ parser
| Date: Wed, 12 Sep 2012 08:13:19 +0200
| […]
| Message-ID: <k2p961$6f4$
1...@tdi.cu.mi.it>
| References: <k2mp5u$edm$
1...@tdi.cu.mi.it>
| […]
|
| Thanks everybody. I was afraid my supposition was too far from what bash
| could give me.
| […]
And that is simply not true. However, your posting and others, that did not
even mention that there was a solution without external tools, mislead the
OP into believing so. More, the OP have been mislead into believing that
the not-shell-only solutions were without any compatibility issues because
compatibility issues also were conveniently left out in their presentation.
As a result, not only have they not learned to leverage the power of sh-
based shells, in particular bash, they also believe now they using issue-
free code. Fortunately in this case there were other people to point out
that there was a shell/bash solution, and that the awk solution was not
without issues itself – as there is not only one awk; where in contrast
there is only one (GNU) bash, albeit in different versions which is not
relevant here. But what if there had not been?
*That* is a Bad Thing, particularly when in originates in comp.unix.*shell*.
The tools are there, and should be discussed *here* as such, to *complement*
the shell command language; _not_ to replace it.
To point that out to the obviously extremely short-sighted, and to ask for
reconsideration of approaches, constitutes anything but whining.
BTW: Trim your quotes to the relevant minimum next time, please.
--
PointedEars