We are moving from an OpenVMS server to a Unix server and I have a problem with ftp'ing files.
When I ftp the VMS server from the Unix server, I need to "mget" some files, for example "mget test_file*.txt;". The semicolon is necessary because OpenVMS has multiple versions of the file (eg test_file.txt;1, test_file.txt;2, etc).
When I do this i end up with the file "test_file.txt;2". I then need to convert this to remove the semicolon.
I have tried various methods and have found one that works :
for file in *.txt*; do
noext="${file%.}"
mv "$file" "${noext#.}.txt"
done
However, I have problems with this :
- it renames ALL .txt files even if they have no ";" and version number.
- it will only do one file extension at a time.
- it is inefficient
What I want is to say "for all files with a semicolon in the file extension, rename the file to everything to the left of the semicolon".
Better yet, "give me all files matching *.txt; from theVMS server, and create them on the Unix server without the ;"
Any suggestions would be appreciated.