Tee with pipe command.

cat work.txt

M|324324|32424|3431
M|324324|32424|3431
N|324324|32426|3432
N|324324|32424|3434
M|324324|32424|3435
cat work.txt | tee $( grep '^M' > m.txt ) | $( grep '^N' > n.txt )
cehpny00:/home01/sr38632 $ cat m.txt
M|324324|32424|3431
M|324324|32424|3431
M|324324|32424|3435
cehpny00:/home01/sr38632 $ cat n.txt
no results.

Why grep '^N' not working. pls help me.

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums