Reading numbers from text file and storing in array
2 Attachment(s)
Dear all!
I'm writing a bash script where I read a text file (containing a column of numbers) and store each line in an array. There seem to be some problems with the whole thing however, but only for some files and not others. Here's what I do: Code:
#!/bin/bash Code:
Code:
test1 0 test2 Ida |
time_notOk.txt has DOS/Windows line ends on all but the last line. These can be seen in vi or using the od command. Fix by, for example, using fromdos command.
|
Dear catkin,
Thank you so much for your reply! You're a lifesaver! I ran the dos2unix (fromdos) command and converted my files and now it's working properly... Thank you! Ida Quote:
|
Glad it solved the problem for you :)
Threads can be marked SOLVED via the Thread Tools menu. |
All times are GMT -5. The time now is 10:14 PM. |