Replace text in vi with confirmation
Answer:
Similar to this article, you want to replace text, but you want to vi/vim to ask for confirmation before the actual replacements.
:%s/foo/bar/gc
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Replace text in vi with confirmation
Answer:
Similar to this article, you want to replace text, but you want to vi/vim to ask for confirmation before the actual replacements.
:%s/foo/bar/gc
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
Convert a Nero .nrg file to .iso file
Answer:
It is easy to convert a Nero .nrg file to an .iso file, using the following command.
# dd bs=1k if=input.nrg of=output.iso skip=300
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:]'
How to validate the format of a XML file in Linux?
Answer:
You can use xmllint, which came as part of the libxml2-utils package.
To install
# sudo apt-get install libxml2-utils
To validate the format of XML document
# xmllint --noout file.xml