Re: [9fans] sed question (OT)

2009-11-11 Thread frankg
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

Re: [9fans] sed question (OT)

2009-10-30 Thread Noah Evans
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) <=

Re: [9fans] sed question (OT) (OT) (OT) (OT) (OT)(OT)(OT)(OT)(OT)(OT)(OT)(OT)(OT)(OT)

2009-10-30 Thread W B Hacker
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

Re: [9fans] sed question (OT) (OT) (OT)

2009-10-30 Thread Tim Newsham
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

Re: [9fans] sed question (OT)

2009-10-30 Thread W B Hacker
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

Re: [9fans] sed question (OT)

2009-10-30 Thread erik quanstrom
On Fri Oct 30 11:31:24 EDT 2009, dav...@mac.com wrote: > You can do it, definitely. > well played! - erik

Re: [9fans] sed question (OT)

2009-10-30 Thread dave . l
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

Re: [9fans] sed question (OT)

2009-10-30 Thread Eris Discordia
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

Re: [9fans] sed question (OT)

2009-10-30 Thread Eris Discordia
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

Re: [9fans] sed question (OT)

2009-10-29 Thread Jason Catena
> 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

Re: [9fans] sed question (OT)

2009-10-29 Thread Lorenzo Bolla
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/^./

Re: [9fans] sed question (OT)

2009-10-29 Thread Iruata Souza
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

Re: [9fans] sed question (OT)

2009-10-29 Thread erik quanstrom
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&/ > > > >

Re: [9fans] sed question (OT)

2009-10-29 Thread Iruata Souza
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

Re: [9fans] sed question (OT)

2009-10-29 Thread erik quanstrom
> 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

Re: [9fans] sed question (OT)

2009-10-29 Thread W B Hacker
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).

Re: [9fans] sed question (OT)

2009-10-29 Thread Lorenzo Bolla
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

[9fans] sed question (OT)

2009-10-29 Thread Steve Simon
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