Question : need batch script to convert all the contents of a file to upper and lower case

i have several files in a folder., each having hostnames of the computer in both small and capital letters,
i want batch script to first to convert all the hostnames into small letters in one file and all the small to capital letters in another file., so tat i wil have two files having same hostnames small and caps.,
now i want to merge those two files.,
the output should be file having all hostnames in both small and caps.,
the output file should be same name as input file., am having 10 to 15 diff input files
urgent...

Answer : need batch script to convert all the contents of a file to upper and lower case

is perl okay?  since you were merging the contents into 1 final file I assume you don't really need the 2 files for each so am only outputting back to the original file.

you execute it as "./script-name your-file" for each file.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
#!/usr/bin/perl
 
die "File not found\n" unless -e $ARGV[0];
open(FILE, $ARGV[0]);
foreach $line () {
        $DATA{lc($line)} = 1;
}
close(FILE);
 
die "Can't write to file $ARGV[0]\n" unless -w $ARGV[0];
open(FILE, "> $ARGV[0]");
foreach $line (sort (keys %DATA)) {
        print FILE $line;
        print FILE uc($line);
}
close(FILE);
Open in New Window Select All
Random Solutions  
 
programming4us programming4us