Regaular Expression

G

gene_leung

Hi All,

What is the easy way to convert the below line using regular
expression:

123 | 456 || abc ||| cdef |||| end ------> 123 | 456 |\N| abc |\N|\N|
cdef |\N|\N|\N| end
Please send me email directly!! Thanks!!

Best Regards
Gene Leung
 
J

John W. Krahn

What is the easy way to convert the below line using regular
expression:

123 | 456 || abc ||| cdef |||| end ------> 123 | 456 |\N| abc |\N|\N|
cdef |\N|\N|\N| end

s'\|(?=\|)'|\N'g;


John
 
J

Jürgen Exner

What is the easy way to convert the below line using regular
expression:

123 | 456 || abc ||| cdef |||| end ------> 123 | 456 |\N| abc |\N|\N|
cdef |\N|\N|\N| end

s/123 | 456 || abc ||| cdef |||| end/123 | 456 |\N| abc |\N|\N|cdef
|\N|\N|\N| end/
(in one line, of course)
This does do what you asked for but maybe meant to ask for something
different?
Please send me email directly!! Thanks!!

That's not how Usenet works.

jue
 
J

Jürgen Exner

Shawn said:
What he means is to Reply All, not just Reply.

???
No idea what you mean with "Reply All". How do you post a reply on Usenet
that is not visible to all?

jue
 
G

gene_leung

Sorry for the wording 'Please send me email directly'

Actually this is what I am doing,

cat some_file | sed 's/|||/|\\N|\\N|g' | sed 's/||/|\\N|/g'

and I do not know the occurence of ||, |||, ||||, |||||, ....
All I want to do is to convert

|| to |\N|
||| to |\N|\N|
|||| to |\N|\N|\N|
|||| to |\N|\N|\N|\N
.....

Thanks in advance.

B/R
Gene Leung
 
B

Brian McCauley

Sorry for the wording 'Please send me email directly'

It's not the wording that is objectionable, it is the sentiment.
Actually this is what I am doing,

cat some_file | sed 's/|||/|\\N|\\N|g' | sed 's/||/|\\N|/g'

Well, since this is a Perl news group, the obvious answer is use Perl
(probably with the -p and -e swiches) not sed. (Correct Perl command
has already been given).

Since this is not a Unix newsgroup I woln't mention that you have a
useless use of cat.
 
S

Shawn Corey

Jürgen Exner said:
???
No idea what you mean with "Reply All". How do you post a reply on Usenet
that is not visible to all?

jue

Reply All means to reply to everyone on the From, Cc, and Reply-to
lists. By doing so you will send the message to the newsgroup and to the
person who originated the message. Most newsgroup readers have a method
to do this with one click of the mouse or if text based, with a single
command. Check the help for your reader.

--- Shawn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top