On Oct 30, 12:58Â pm, noah.ev...@gmail.com (Noah Evans) wrote:
> This kind of problem is character processing, which I would argue is
> C's domain. You can massage awk and sed to do the job for you, but at
> least for me it's conceptually simpler to just bang out the following
> C program:
>
> #inc
This kind of problem is character processing, which I would argue is
C's domain. You can massage awk and sed to do the job for you, but at
least for me it's conceptually simpler to just bang out the following
C program:
#include
#include
#include
#define isupper(r) (L'A' <= (r) && (r) <=
Tim Newsham wrote:
Call me a Dinosaur, but - so long as it is ASCII or EBCDIC it is
relatively trivial to implement that in hardware AND NOT have the
issue of altering any but the first two words AND NOT have issues
where there is only one word or a numeral or punctuation or
hidden/control cha
Call me a Dinosaur, but - so long as it is ASCII or EBCDIC it is relatively
trivial to implement that in hardware AND NOT have the issue of altering any
but the first two words AND NOT have issues where there is only one word or a
numeral or punctuation or hidden/control character rather than al
Eris Discordia wrote:
The script has a small "bug" one might say: it capitalizes the first two
words on a line that are _not_ already capitalized. If one of the first
two words is capitalized then the third will get capitalized.
Call me a Dinosaur, but - so long as it is ASCII or EBCDIC it is
On Fri Oct 30 11:31:24 EDT 2009, dav...@mac.com wrote:
> You can do it, definitely.
>
well played!
- erik
You can do it, definitely.
Caveat: I'm in bed with a virus and the brain's on impulse power
so these are untested and may be highly suboptimal.
Is the input guaranteed to have 2 words on each line?
What are your definitions of words and blanks?
I know from your snippet that there's no leading b
Listing of file 'sedscr:'
s/^/ /;
s/$/aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ/;
s/ \([a-z]\)\(.*\1\)\(.\)/ \3\2\3/;
s/ \([a-z]\)\(.*\1\)\(.\)/ \3\2\3/;
s/.\{52\}$//;
s/ //;
$ echo This is a test | sed -f sedscr
This Is a test
$ echo someone forgot to capitalize | sed -f sedscr
Som
The script has a small "bug" one might say: it capitalizes the first two
words on a line that are _not_ already capitalized. If one of the first two
words is capitalized then the third will get capitalized.
--On Thursday, October 29, 2009 15:41 + Steve Simon
wrote:
Sorry, not really th
> Sorry, not really the place for such questions but...
Try stackoverflow.com. They delight in problems such as these.
> I am trying to capitalise the first tow words on each line
I store the original line with h, and then pull it back out repeatedly
with G to mangle it.
I got far enough to tra
I forgot the "9".
This works for GNU sed version 4.2.1
L.
On Thu, Oct 29, 2009 at 4:33 PM, Iruata Souza wrote:
> On Thu, Oct 29, 2009 at 2:06 PM, Lorenzo Bolla wrote:
> > To capitalize the first letter of each line wouldn't this be enough?
> > s/^./\u&/
> >
> > L.
>
> % echo rwrong | sed 's/^./
On Thu, Oct 29, 2009 at 2:06 PM, Lorenzo Bolla wrote:
> To capitalize the first letter of each line wouldn't this be enough?
> s/^./\u&/
>
> L.
% echo rwrong | sed 's/^./\u&/'
urwrong
On Thu Oct 29 12:31:23 EDT 2009, iru.mu...@gmail.com wrote:
> On Thu, Oct 29, 2009 at 2:08 PM, erik quanstrom wrote:
> >> To capitalize the first letter of each line wouldn't this be enough?
> >>
> >> s/^./\u&/
> >
> > ; echo abc def | sed 's/^.\u&/'
> > sed: s command garbled: s/^.\u&/
> >
>
>
On Thu, Oct 29, 2009 at 2:08 PM, erik quanstrom wrote:
>> To capitalize the first letter of each line wouldn't this be enough?
>>
>> s/^./\u&/
>
> ; echo abc def | sed 's/^.\u&/'
> sed: s command garbled: s/^.\u&/
>
i guess you missed the second slash
> To capitalize the first letter of each line wouldn't this be enough?
>
> s/^./\u&/
; echo abc def | sed 's/^.\u&/'
sed: s command garbled: s/^.\u&/
- erik
Steve Simon wrote:
Sorry, not really the place for such questions but...
I always struggle with sed, awk is easy but sed makes my head hurt.
I am trying to capitalise the first tow words on each line (I could use awk
as well but I have to use sed so it seems churlish to start another process).
To capitalize the first letter of each line wouldn't this be enough?
s/^./\u&/
L.
On Thu, Oct 29, 2009 at 3:41 PM, Steve Simon wrote:
> Sorry, not really the place for such questions but...
>
> I always struggle with sed, awk is easy but sed makes my head hurt.
>
> I am trying to capitalise t
Sorry, not really the place for such questions but...
I always struggle with sed, awk is easy but sed makes my head hurt.
I am trying to capitalise the first tow words on each line (I could use awk
as well but I have to use sed so it seems churlish to start another process).
capitalising the fir
18 matches
Mail list logo