0

Using sed, how would I change Popeye’s birthday to 11/14/46? Assume you don’t know Popeye’s original birthday.

The input filename is datebook, as follows:

Arthur Putie:923-835-8745:23 Wimp Lane, Kensington, DL 38758:8/31/69:126000
Popeye Sailor:156-454-3322:945 Bluto Street, Anywhere, USA 29358:3/19/35:22350
Jose Santiago:385-898-8357:38 Fife Way, Abilene, TX 39673:1/5/58:95600

I tried

sed ‘^\(/Popeye/s/[0-9]{5}\):/\1:11/14/46’ datebook 

but it did not work.

2
  • 1
    What is your question? You want to write a parser to pick out the relevant data and replace it for you? That might be better on Stack Overflow, but as it is I'm not even sure this is a real question.
    – Shinrai
    Oct 4, 2012 at 19:58
  • Reopened since after the OP's clarification, this question became answerable.
    – slhck
    Oct 4, 2012 at 20:53

1 Answer 1

2

There are numbers, slash, numbers, slash, numbers. Use an alternate separator to avoid backslashed slashes:

sed '/Popeye/s,[0-9]\+/[0-9]\+/[0-9]\+,11/14/46,'
1
  • sed '/Popeye/s,[0-9]\+/[0-9]\+/[0-9]\+,11/14/46,' => This works great. Thank you Choroba
    – Steve
    Oct 5, 2012 at 7:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .