awk
way 1
awk '{if (/root/) print > "match"; else print > "nomatch"; }' /etc/passwd
way 2
awk '{ print > ( /root/ ? "match" : "nomatch" ) }' /etc/passwd
sed
All these below are implementations of test condition like if else in sed
way 1
sed -ne '/root/w match' -e '/root/!w nomatch' /etc/passwd
way 2
sed -ne '/root/bOK; w nomatch' -e 'b; :OK; w match' /etc/passwd
way 3
sed -n '/root/p; //!w nomatch' /etc/passwd > match
way 4
sed -n '/root/!p; //w match' /etc/passwd > nomatch