Question: I'm a bit useless at Linux CLI, and I am trying to run the following commands to randomly sort, then split a file with output file prefixes 'out' (one output file will have 50 lines, the other the rest):

```
sort -R somefile  | split -l 50 out

```

I get the error

```
split: cannot open ‘out’ for reading: No such file or directory

```

this is presumably because the third parameter of split should be its input file. How do I pass the result of the sort to split? TIA!!

Answer: 
Use `-` for stdin:

```
sort -R somefile  | split -l 50 - out

```

From `man split`:

> 
> Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'. With no
>  INPUT, **or when INPUT is -**, read standard input.
> 
> 
> 

Allowing `-` to specify *input is stdin* is a convention many UNIX utilities follow.
For POSIX systems like mac os the `-` parameter is not accepted and you need to completely omit the filename, and let it generate it's own names.

```
sort -R somefile | split -l 50

```