Sebastian Zeki
Sebastian Zeki

Reputation: 6874

Ruby script being a pain to run

I have a .gz file in a folder called SequenceScripts. I would like to unzip it and then run a ruby script on it which reformats it and puts it in a text file. The ruby script is in the same folder. I am doing this using Terminal on a mac.

The command I am using is:

gzcat tbb.fq.gz | ./reformat_sequence_data.rb > SLX-8691.ART03.txt

The response I am getting is: env: ruby\r: No such file or directory

The ruby script starts with:

#!/usr/bin/env ruby

There are no carriage returns in the script (checked with hidden characters visible). When I run ruby -v from the command line I get: ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

I have no idea whats going on but I suspect the extra carriage return may have something to do with it but I dont know why its there. Can anyone help?

Upvotes: 1

Views: 84

Answers (1)

konsolebox
konsolebox

Reputation: 75558

I suggest that you just run dos2unix or sed on it anyway:

dos2unix ./reformat_sequence_data.rb
sed -i 's|\r||' ./reformat_sequence_data.rb 

If your file has \r (0D), lines will show with this command:

hexdump -C < ./reformat_sequence_data.rb | grep -w 0d

Upvotes: 1

Related Questions