@Freedo Why would it be safe? What level of "safe" are you requiring? If you have issues with processes in uninterruptible sleep, I would suggest that you opt for fixing those/that program rather than introducing hacky kernel modules that you (or I or anyone who's not a kernel developer) don't understand the consequences of running.
@FaheemMitha The user in the question mentions standard input and also about "input" without saying what form this is in. The answer can be used as a part of a pipeline, as it would read from standard input.
Well, you either just tuck a filename in before the pipe symbol (iconv would open the file and read from it), or you use < file somewhere on the left hand side of the pipe, or you pipe from cat file into it.
Well, I'm afraid that you will have to understand the tool that is given to you before you can use it effectively.
@FaheemMitha What's the meaning of life? ... is also a simple question. It's difficult to find the answer to it though. And the anwer may be verry complicated.
Celada's answer works as written. The question asked about printing out unicode values from standard input. That's the actual title, and the answer tells us how to do literally that.
In this case, I believe you are expecting Celada's answer to answer some other question too.
@FaheemMitha Could you give an example? If I create a table with a single TEXT column and then insert some data into that, and then select all data from that table, I don not get a DOS formatted text file.
@FaheemMitha Does SQLite3 have some special CSV-formatting output thing, or do you create CSV "manually" by quoting fields and concatenating them with commas?
From here and d5e5's comment:
You'll have to switch the output to csv-mode and switch to file output.
sqlite> .mode csv
sqlite> .output test.csv
sqlite> select * from tbl1;
sqlite> .output stdout
I used @gdw2's answer. Verbatim.
Still don't see why it would produce a file with DOS endings, though. Let me know if you can reproduce it.
That's actually in line with RFC4180 (datatracker.ietf.org/doc/html/rfc4180). That's the RFC that defines the CSV format. It requires that lines end in CRLF.
Yes, I can reproduce it.
If it's an issue, then simply run it through dos2unix or some other transformation that deletes the \r at the end of each line.
I think I knew about that form a long time before, but I don't think I've ever seen a piece of software actually using CRLF when producing CSV output on Unix.
Does anyone feel like commenting on this? I'm considering posting this on StackOverflow, but I thought I would first ask if I was doing something obviously wrong.