Unix Script Help
Hi,
Trying to use SED with no luck.
I have a line in a file:
E=23=2003082163229=5.0#509=R000=MannMa@COSINC32341 2=
I want to extract from this line the MannMa part only - however this part will change depending on user so it isn't constant. The R000= before it is though if this is any help. I've played around with SED but can't get it to work. Any ideas?
Cheers
Marc
Trying to use SED with no luck.
I have a line in a file:
E=23=2003082163229=5.0#509=R000=MannMa@COSINC32341 2=
I want to extract from this line the MannMa part only - however this part will change depending on user so it isn't constant. The R000= before it is though if this is any help. I've played around with SED but can't get it to work. Any ideas?
Cheers
Marc
You might have been better off using awk, but anyway, with sed, it's not too hard. There's probably a more elegant way, but this took me 30 seconds to come up with: 
(assuming your list of strings is in a file called 'input')
$ cat input | sed 's/^.*=R000=//' | sed 's/@.*$//'
^.* matches everything from the beginning of the line (so up to and including the =R000= in this case)
.*$ matches everything to the end of the line (so everything including and after the @)
Rich.

(assuming your list of strings is in a file called 'input')
$ cat input | sed 's/^.*=R000=//' | sed 's/@.*$//'
^.* matches everything from the beginning of the line (so up to and including the =R000= in this case)
.*$ matches everything to the end of the line (so everything including and after the @)
Rich.
Trending Topics
Thread
Thread Starter
Forum
Replies
Last Post
Karlos
Computer & Technology Related
9
Mar 10, 2002 03:23 PM




