Featured Post

Python Set Operations Explained: From Theory to Real-Time Applications

Image
A  set  in Python is an unordered collection of unique elements. It is useful when storing distinct values and performing operations like union, intersection, or difference. Real-Time Example: Removing Duplicate Customer Emails in a Marketing Campaign Imagine you are working on an email marketing campaign for your company. You have a list of customer emails, but some are duplicated. Using a set , you can remove duplicates efficiently before sending emails. Code Example: # List of customer emails (some duplicates) customer_emails = [ "alice@example.com" , "bob@example.com" , "charlie@example.com" , "alice@example.com" , "david@example.com" , "bob@example.com" ] # Convert list to a set to remove duplicates unique_emails = set (customer_emails) # Convert back to a list (if needed) unique_email_list = list (unique_emails) # Print the unique emails print ( "Unique customer emails:" , unique_email_list) Ou...

Vi Editor to Quit use Esc and Colon

Here are vi editor commands you can use to quit from Vi editor with or without saving your work. These are useful to use in day-to-day work.

w => To Save Your Work
q => To Quit
wq => To Save and Quit
q! => To quit without saving


vi editor also called Visual editor in terms of Unix or Linux or Ubuntu Operating systems. Since all are the same UNIX flavor, and UNIX is the mother of all these operating systems.


Recently many of my friends asked to share some daily use vi editor commands. I am sharing those for your quick reference.

6 Top vi Editor Commands


1. How to Edit a file?

vi filename

This is the first command to use for editing a file.


2. A command to Repeat Previous Command?

Use the UP arrow to repeat the previous command.


3. How to Insert data?

Use insert command to over-type data.


4. How to Save File?

Press Esc
then
:w

5. How to Save and Quit (Exit)?

Press Esc
then
:wq

6 How to quit without Save?

Press Esc
then
:q!

Comments

Popular posts from this blog

SQL Query: 3 Methods for Calculating Cumulative SUM

Big Data: Top Cloud Computing Interview Questions (1 of 4)

Python placeholder '_' Perfect Way to Use it