I understand and accept the premise that defensive1 shell scripting is both prudent and, in the longer term, more sustainable.
Everybody knows 🙂 that in Windows plain text files lines are terminated with CR+LF, and in Unix&Linux – with LF only. How can I quickly convert all my source code files from one format to another and back?
The read utility shall read a single line from standard input.
Remove ^M character from log files.
Is it possible to use the
find command to find all the “non-binary” files in a directory? Here’s the problem I’m trying to solve.
I’m looking for a way to only execute replacement when the last character is a newline, using
I’ve been using
sed for quite some time but here is a quirk I came around with, which I am not able to resolve.
As a simple example, I have a bunch of source code files. I want to store the “head” command output to a variable for all these files.
When I try to run the following script in zsh, via the command
/bin/zsh ~/.set_color_scheme.sh I get the following error:
I have a file that only uses
n for new lines, but I need it to have
rn for each new line. How can I do this?