-
All replies
-
Helpful answers
-
Jun 26, 2016 10:31 AM in response to Tony T1by Cartaphilis,What do I need to change to make this work with a tab delimited file?
-
Jun 26, 2016 5:03 PM in response to Cartaphilisby Tony T1,To work with a tab delimited file, change:
OldImageName=${line%,*}
NewImageName=${line#*,}
to:
OldImageName=${line%$'\t'*}
NewImageName=${line#*$'\t'}
-
Jun 26, 2016 5:24 PM in response to Tony T1by Cartaphilis,That is what I thought too but no dice. I wonder if my file is the issue?
-
Jun 26, 2016 5:28 PM in response to Cartaphilisby Cartaphilis,Got it. Had to resave file to format "Windows Formatted Text"
-
Jun 27, 2016 5:00 AM in response to Cartaphilisby Tony T1,>That is what I thought too but no dice. I wonder if my file is the issue?
Could be the line endings in the file. The script is expecting a UNIX \n, but could be a Windoes \r\n
Need to see what line endings are used in your csv file:
In Terminal, try cat -e on the text file to view the line endings (if a UNIX \n you'll see $ at the end, if Windows, you'll see ^M$)
If it is a non-UNIX file, you can convert the file with tr by deleting the carriage return \r:
tr -d '\r' < ~/Desktop/originalfile.csv > ~/Desktop/Newfile.csv
Then you can run the script on Newfile.csv
edit: Never mind, I see now that you solved it.
-
Jun 27, 2016 5:16 AM in response to Tony T1by Cartaphilis,Thanks Tony. I like your solution and you were right it was seeing the windows format. Now all I have to do is get it to see leading zeros in the old file name. Thanks you again.
