The below "one liner" explains what I'm trying to do:
pbpaste > ~/Documents/convertme.txt; \
dos2unix -c mac ~/Documents/convertme.txt && \
cat ~/Documents/convertme.txt | pbcopy && \
rm -vfr ~/Documents/convertme.txt
I don't like creating a temporary file, I would rather everything be handled in memory through piping the input/output all the way through.
Something like:
pbpaste | dos2unix -c mac -n /dev/stdin /dev/stdout | pbcopy
Which does not work, it errors: dos2unix: Skipping /dev/stdin, output file /dev/stdout is a symbolic link.
The only other solution I thought of was perhaps creating a shell script to handle this with variables... but I thought I'd ask here because I figured there might still be a way to pipe into and out of dos2unix.
I've searched all over StackOverflow and cannot find a duplicate question, however I'm sure there is a command similar to dos2unix which somebody has worked this flow out for. If that is the case, I'll accept an answer with that link but please also re-write the answer with dos2unix
written out in the proper piped command (for future readers and those like me who can't find this indexed in google).
Copyright License:
Author:「Jeremy Iglehart」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/55002382/how-to-pipe-into-and-out-of-dos2unix-on-a-mac