How to pipe into and out of dos2unix on a mac

2019-03-05T20:00:00

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

About “How to pipe into and out of dos2unix on a mac” questions

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 &&...
What I'm attempting to do: Line 1: find any .txt or .TXT file and pipe them into next command Line 2: convert the .txt file to unix format (get rid of Windows line endings) Line 3: delete the last...
We used to edit a payload script via the terminal on an old server. To ease up and avoid typos I'd like to design a php script that generates the payload, save it to a file and use the built-in FTP
I am learning perl programming. I have run a perl script in windows platform but I need to run it in Linux platform like in Ubuntu. My script run perfectly in windows but not in Linux. I am not fam...
I need to execute the dos2unix command in a variable. With files we just do dos2unix myfile.txt. How can I do that with a variable? For example: variable="bla\r" dos2unix $variable Sugestions using
How can I configure my svn client (/bin/svn) to check out files under a default permission setting (e.g. umask 0022 or chmod 755) as well as to instantly convert them from DOS file format? Currentl...
I was calling dos2unix from within Python this way: call("dos2unix " + file1, shell=True, stdout=PIPE) However to silence the Unix output, I did this: f_null = open(os.devnull, 'w') call("dos2un
I tried creating a pipe on a Mac host using mkfifo and reading from a Linux VM. I encountered some issues with concurrent reading and writing and am wondering if there are other ways to make a one...
How to create a command line pipe? (xcode mac os x) Hello I want to create a command line with xcode (mac os x) that had the quality of being used in pipe after "|" . i know that by using ...
When running dos2unix on a file I get the following printed to the terminal dos2unix: converting file <filename> to UNIX format ... In my attempt to suppress the output by sending it to /de...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.