The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
3answers
316 views

How to read '\n' into variable with Bash's built-in command?

Somehow I'm not able to read the trailing \n sign into the REPLY variable. Under any circumstances I want to avoid a blank line that results from the \n being echoed by read but echo one in case of ...
2
votes
4answers
2k views

How to detect dos format files in git bash

Git Bash is a nice bash shell you get in Windows as part of the installation of Git. It comes with other typical unix tools bundled inside, such as grep, sed, awk, perl. It doesn't have the file ...
0
votes
1answer
230 views

what is the best way to convert CRLF to LF and the viceversa for C++ files in my project [duplicate]

Possible Duplicate: How to bulk convert all the file in a file system branch between Unix and Windows line break format? which is the best tool to convert the CRLF to LF for my project in ...
0
votes
1answer
2k views

Script failing with “command not found: ^M”

When I try to run the following script in zsh, via the command /bin/zsh ~/.set_color_scheme.sh I get the following error: command not found: ^M The script has u+x permissions and it used to work on ...
3
votes
1answer
518 views

Does input redirection (<) append a newline character?

I was originally of the impression that $ ./myprog moo[CTRL-D] is exactly the same as $ echo moo > cow $ ./myprog < cow But I found that myprog always counts one more \n in the second ...
8
votes
2answers
3k views

Finding all “Non-Binary” 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've getting an archive of files from a windows user. This archive ...
5
votes
3answers
2k views

Collapsing a stream of multiple lines into one line

I have a file containing a a large number of lines, each of which contains a bunch of numbers which are separated by spaces. I process this data in a pipe in some way, and then I want to collapse the ...
4
votes
4answers
3k views

concatenate two files without adding a newline

If I nano two files, one of which reads 'this' without me entering a newline, and one of which reads 'is' without me entering a newline, I want to be able to then cat the two files together into ...
4
votes
3answers
511 views

How to skip file in sed if it contains regex?

I currently use the following simplified command to remove trailing whitespace and add a newline at end of file where needed: find . -type f -exec sed -i -e 's/[ \t]\+\(\r\?\)$/\1/;$a\' {} \+ As ...
5
votes
2answers
15k views

Removing all spaces, tabs, newlines, etc from a variable?

This is the error I am getting and it's failing because of a variable whose value is supposed to be 2 (I am getting this using a select * from tabel). I am getting spaces in that variable. + 0 != ...
44
votes
6answers
43k views

How to add a newline to the end of a file?

Using version control systems I get annoyed at the noise when the diff says No newline at end of file. So I was wondering: How to add a newline at the end of a file to get rid off those messages?
3
votes
3answers
2k views

How to bulk convert all the file in a file system branch between Unix and Windows line break format?

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 ...
38
votes
4answers
7k views

What's the point in adding a new line to the end of a file?

Some compilers (especially C or C++ ones) give you warnings about: No new line at end of file I thought this would be a C-programmers-only problem, but github displays a message in the commit view: ...