It will accept two parameters.
1. SourceFileName
2. TargetFileName
proc fnSortTheFileInReverseOrder { sourceFileName targetFileName args } {
if { ![ file exists $sourceFileName]} {
return 1
}
if { $targetFileName == “” } {
set $targetFileName “$sourceFileName.srt”
}
if [ catch { exec sort -r $sourceFileName > $targetFileName } err ] {
echo ” Error occurred while reverse sorting the $sourceFileName file nError: $err…”
return 1
}
return 0
}
Usage:
fnSortTheFileInReverseOrder $sourceFileName $targetFileName