On Sun, May 20, 2007 at 10:41:39AM +0300, Dotan Shavit wrote:
> Hi Avraham,
> 
> I'd go for something more strict like:
> sed 
> "s/\([0-9][0-9]:[0-9][0-9]\)\([^\t]*\t\t\)\([0-9][0-9]:[0-9][0-9]\).*/\1-\3 
> $1 \2/"
> 
> Dotan
> 
> 
> On Saturday 19 May 2007, Avraham Rosenberg wrote:
> > Hi,
> > The problem popped up in the frame of my attempts to switch to
> > utf8. I opened a uxterm window with the command:
> > LC_TYPE=he_IL.UTF8 uxterm -sb -sl 500  -xrm 'xterm*pointerShape:
> > hand2' -geometry 100x40 -bg grey90 -fg black -fn
> > '-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1'&
> >
> > and tried to execute a script involving sed.
> > In its simplest form, it looks like:
> > cat v | start-end2
> > where v is:
> >     21:45 Les elephants d'Hannibal          22:35 360? Le reportage GEO
> >     22:35 360? Le reportage GEO             22:36 Les metallos de Chicago
> >     22:36 Les metallos de Chicago           21:45 Les elephants d'Hannibal
> > and start-end2 is
> > #!/bin/sh
> > sed "s/\([0-9][0-9]:[0-9][0-9]\)\(.*                
> > \)\([0-9][0-9]:[0-9][0-9]\).*/\1-\3
> > $1 \2/"
> >
> > The big space in the script (2 tabs) corresponds to the two tabs between
> > the two columns of v
> >
> > In the uxterm window, the output was:
> >     21:45-22:35   Les elephants d'Hannibal          ? Le reportage GEO
> >     22:35 360? Le reportage GEO             22:36 Les metallos de Chicago
> >     22:36-21:45   Les metallos de Chicago
> > Instead of the normal output (in the xterm window):
> >     21:45-22:35   Les elephants d'Hannibal
> >     22:35-22:36   360? Le reportage GEO
> >     22:36-21:45   Les metallos de Chicago
> > sed version: GNU sed version 4.1.5
> >
> > Should I update/replace my sed or use some command-line option to
> > make it behave similarly in the two environements ?
> > Thanks, Avraham
> 
> 
Hi Dotan,
Thanks for the answer. If your message did not get too garbled on
the way, you suggest to replace my \2 from "anything beyond the
first hour, ending with two tab characters" to something else.
I am affraid that, trying to keep the message short, I omitted some
relevant information:
1-This is only part of a longer script, the preceding lines of
which make sure that all the hours appear in [0-9][0-9]:[0-9][0-9]
format and that the space is 2 tabs, indeed.
2-The question mark after 360 was, in the original text 
(written in ISO8859-1), the sign for degrees (hex code \0b0), and 
so it looked in my xterm. Passing through the mail, it became a
question mark.  In the uxterm, it looked very strange, but that, 
in my understanding, should not have affected the behaviour of
sed. In fact, it did (if one deletes or replaces this character
with anything else, one gets in uxterm the same ouput as in
xterm). This is my real question: my script may be mistaken and
give some other output than desired, but why is the behaviour in
uxterm different than in xterm ?
I regret my former misleading formulation. I hope it is clearer,
now.
Cheers, Avraham
-- 
Please avoid sending to this address attachments in excess of 2MByte, 
or any Excell or Powerpoint attachments.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

  • sed Avraham Rosenberg

Reply via email to