Hi Folks
I would like to know how to use Qshell to tidy up file names of files coming into the IFS from outside.
I have searched extensively for info on MV and SED but the few pages I found were either for renaming every file in a directory (I want to do just one at a time) or they were some other flavour of shell that works differently or has different switches/flags.
The main application would be removing embedded blanks in file names (e.g. replacing them with underscores or just pushing the words together). Ideally I'd like to be able to replace any number of consecutive blanks with one replacement character, e.g. (with : standing for blank) "A:very:slapdash:::file:name.csv" with "A_very_slapdash_file_name.csv", but code for one-for-one replacement would still be very useful.
There might be cases too where I want to shorten a name so if you also know a truncation technique that respects word boundaries that would be a bonus (e.g. make the name no more than 30 characters but without splitting a word ... or ... from position 25 find the next blank and truncate there).
I would like to know how to use Qshell to tidy up file names of files coming into the IFS from outside.
I have searched extensively for info on MV and SED but the few pages I found were either for renaming every file in a directory (I want to do just one at a time) or they were some other flavour of shell that works differently or has different switches/flags.
The main application would be removing embedded blanks in file names (e.g. replacing them with underscores or just pushing the words together). Ideally I'd like to be able to replace any number of consecutive blanks with one replacement character, e.g. (with : standing for blank) "A:very:slapdash:::file:name.csv" with "A_very_slapdash_file_name.csv", but code for one-for-one replacement would still be very useful.
There might be cases too where I want to shorten a name so if you also know a truncation technique that respects word boundaries that would be a bonus (e.g. make the name no more than 30 characters but without splitting a word ... or ... from position 25 find the next blank and truncate there).
Comment