Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jul 042010
 

Replace text in vi

Answer:

To replace a text in a file using vi/vim

Enter the command mode by typing :, and use the %s/foo/bar/g for global replacement(s).

:%s/foo/bar/g

All foo in the file will be replaced by bar

Jun 172010
 

Case conversion of string in Linux

Answer:

To convert a string to upper case letter, you can use the following command.

# echo 'Test' | tr '[:lower:]' '[:upper:]'

On the other hand, if you want to convert from upper case to lower case, you can use

#echo 'Test' | tr '[:upper:]' '[:lower:]'