<div dir="ltr">Oh, I see what you're doing. Thanks, that works!</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 29, 2016 at 10:11 AM, Paul Sierks <span dir="ltr"><<a href="mailto:psierks@sierkstech.net" target="_blank">psierks@sierkstech.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">.* Is greedy,<br><br>sed "s/^.*\/\([^_@]*\).*$/\1/"<br><br>Kevin McGregor <<a href="mailto:kevin.a.mcgregor@gmail.com" target="_blank">kevin.a.mcgregor@gmail.com</a>> wrote:<br><br><div dir="ltr">I'm using sed to massage some input. Specifically, I have input lines like<div><br></div><div>aaaaaaaaaa/BBBBB_ccc@00000</div><div>or</div><div>aaaaaaaaaa/BBBBB@00000</div><div><br></div><div>and I want the output to always be</div><div><br></div><div>BBBBB</div><div><br></div><div>I've got most of it, but I can't figure out how to get rid of anything at the end of the line after EITHER the underscore OR the '@' (including either of those two characters).</div><div><br></div><div>Is this possible in one expression in sed? I can do it with piping the input through sed twice but I was wondering if one pass would do it. Currently I'm using</div><div><br></div><div>sed "s/^.*\/\(.*\)[_@].*$/\1/"<br></div><div><br></div><div>Which doesn't get rid of the "_ccc" when it appears, just the "@00000".</div><div><br></div><div>Suggestions?</div></div>
<br>______________________________<wbr>_________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.ca">Roundtable@muug.ca</a><br>
<a href="https://muug.ca/mailman/listinfo/roundtable" rel="noreferrer" target="_blank">https://muug.ca/mailman/<wbr>listinfo/roundtable</a><br>
<br></blockquote></div><br></div>