This command uses tr command to translate all uppercase characters to lowercase characters in a file.
#!/bin/bash # Write a shell script to translate all the characters to lower case in # a given text file. # ------------------------------------------------------------------------- # Copyright (c) 2001 nixCraft project <http://cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ------------------------------------------------------------------------- echo -n "Enter a text file name : " read file if [ ! -f $file ] then echo "$file not a file!" exit 1 fi cat $file | tr '[A-Z]' '[a-z]'
Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our email newsletter to make sure you don't miss a single tip/tricks.
- Download Script
- Email this to a friend
- Printable version
- Rss Feed
{ 0 comments… add one now }