Reputation: 274
I have a fairly simple bash script that does some grep to find all the text in a file that does not match a pattern.
grep -v $1 original.txt >trimmed.txt
The input file ends each line with the Windows line end characters, i.e., with a carriage return and a line feed CR LF.
The output of this command (run in Cygwin) ends each line with an extra carriage return, i.e., CR CR LF.
How do I tell grep to just use CR LF?
Upvotes: 2
Views: 3290
Reputation: 272267
I think you can only configure the EOL setting during Cygwin install.
If you run your original file through dos2unix
first, then grep
should be able to process properly (you may wish to run through unix2dos
afterwards to revert the EOLs)
Upvotes: 3