===========================================================================
SED - Substitute word
===========================================================================
[prabhucloudxlab@cxln4 ~]$ cat>hello.sh
SED - Substitute word
===========================================================================
[prabhucloudxlab@cxln4 ~]$ cat>hello.sh
#! /bin/bash
#Substitute word
echo "enter filename to substitute using sed"
read fileName
if [[ -f $fileName ]]
then
sed 's/linux/Unix/g' $fileName
else
echo "$fileName doesn't exist"
fi
[prabhucloudxlab@cxln4 ~]$ sh hello.sh
enter filename to substitute using sed
filegrep.txt
unix is great os. unix is opensource. unix is free os.
learn operating system.
Unix Unix which one you choose.
uNix is easy to learn.unix is a multiuser os.Learn unix .unix is a powerful.
ThIs Is LInux 2000
ThIs Is WIndows 3000
ThIs Is MAC 4000
ThIs Is LInux 2000
ThIs Is WIndows 3000
Note:
linux not replace with Unix, Because in Inout file(filegrep.txt), L is capital in Linux word
we have to use case sensitive(i)