Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confirm line delete

Tags:

I have created a function to search all double lines in a file.

I use the "line-number"g/.*/d to delete the line.

However I would like to confirm if a line has to be deleted or not, like the s/..//gc command

Is it possible to delete a certain line with the global or substitute
command and confirm every action?

like image 390
Reman Avatar asked Jul 09 '11 07:07

Reman


People also ask

What happens when you delete LINE?

When you delete the LINE app from your smartphone or PC, the chat history on the device will be deleted. However, even ... LINE is a tool to communicate with family and friends. To allow other users to recognize who you are on LINE, the name you have set, your profile picture and status message will be visible to them.

Are you sure you want to delete in JavaScript?

Use Window confirm() method in the client-side to confirm delete before delete in JavaScript. When you want to verify the user or delete something, it always a good idea to confirm the request before processing. The confirm() method show a dialog box with a message and two buttons (OK and Cancel).

How do I enable the delete confirmation dialog box?

By using the registry editor, the user can also enable the delete confirmation dialog box. Follow the below instructions. From the Start menu, open the Run dialog box or you can press the "Window + R" key to open the RUN window.

How to enable confirm delete in Windows 10?

The first and simplest method to enable the confirm delete Windows 10 feature is to use the Recycle Bin properties option. To do so, follow the step-by-step guide below: Step 1. Right-click the Recycle Bin shortcut on your desktop and select Properties from the pop-up menu. Step 2.

How to display delete confirmation dialog in Recycle Bin?

Right-click on the Recycle Bin folder and click on the "Properties" option. "Recycle Bin Properties" window will appear on the screen. Click (select) on the "Display delete confirmation dialog" option and click on the "Apply" button to proceed. And, when you delete any file or folder then, the delete confirmation dialog will appear on the screen.

How to delete an image using confirmdelete ()?

function confirmDelete () { var r=confirm ("Are you sure you want to delte this image"); if (r==true) { //User Pressed okay. Delete } else { //user pressed cancel. Do nothing } } <img src="deleteicon.png" onclick="confirmDelete ()"> You might want to pass some data with confirmDelete to determine which entry is to be deleted


2 Answers

If I wanted to delete lines in a file and confirm each one, I would:

  • search for the first one
  • if I want to delete it, press dd
  • search for the next one with n
  • if I want to delete that, press ., else n again
like image 25
Greg Hewgill Avatar answered Oct 13 '22 15:10

Greg Hewgill


Why not try a substitute command instead of the delete command?

"line-number"s/^.*$\n//c
like image 121
Prince Goulash Avatar answered Oct 13 '22 15:10

Prince Goulash