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:
#include
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
st...@quintile.net wrote:
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
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
On Fri Oct 30 11:31:24 EDT 2009, dav...@mac.com wrote:
You can do it, definitely.
well played!
- erik
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
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
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
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 u.h
#include libc.h
#include bio.h
#define isupper(r) (L'A' =
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 st...@quintile.net 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
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/
; echo abc def | sed 's/^.\u/'
sed: s command garbled: s/^.\u/
- erik
On Thu, Oct 29, 2009 at 2:08 PM, erik quanstrom quans...@quanstro.net 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
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 quans...@quanstro.net 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
On Thu, Oct 29, 2009 at 2:06 PM, Lorenzo Bolla lbo...@gmail.com wrote:
To capitalize the first letter of each line wouldn't this be enough?
s/^./\u/
L.
% echo rwrong | sed 's/^./\u/'
urwrong
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 iru.mu...@gmail.com wrote:
On Thu, Oct 29, 2009 at 2:06 PM, Lorenzo Bolla lbo...@gmail.com wrote:
To capitalize the first letter of each line wouldn't this be enough?
s/^./\u/
L.
%
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
17 matches
Mail list logo