Pages

Subscribe:

Shell Script--Character Replace By Next Character


Write a shell script to encrypt the content of a file using logic .

 (i) Replace a character by just next character in the cycle for example A by B ( or a by b), B by C (or b   by c), Y by Z (or y by z), Z by A ( or z by a).


(ii) Leave numbers and any other symbols unchanged.


#!/bin/bash
str=""
echo " enter a file name "
read str
cat $str | tr '[abcdefghijklmnopqrstuvwxyz]' '[bcdefghijklmnopqrstuvwxyza]' | tr '[ABCDEFGHIJKLMNOPQRSTUVWXUZ]' '[BCDEFGHIJKLMNOPQRSTUVWXUZA]' >output.txt
cat output.txt

   

comments powered by Disqus
 

Listed In

Bloggers - Meet Millions of Bloggers http://Link-exchange.comxa.com
Blog Search: The Source for Blogs Internet Blogs

Disclaimer

The contents in this blog are taken from various sources available over the internet, therefore we do not gurantee of it's accuracy, if you find any of the content in the blog is infringing it's copyright, please do email us on '123techguide@gmail.com' and we will make sure to remove the same from the blog at the earliest.