top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How we can delete multiple lines from vi editor at one shot?

+2 votes
457 views
How we can delete multiple lines from vi editor at one shot?
posted Jun 8, 2015 by Amit Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer

dd Deletes the line the cursor is on.

1) now say you want to delete the 10 line then press 10dd
2) to delete all the line of the file Type gg to move the cursor to the first line of the file, if it is not already there followed by typing dG to delete all the lines.
3) to delete all the lines from the current line just press dG.

answer Jun 8, 2015 by Salil Agrawal
nicely explained.
Similar Questions
–1 vote

I have a large file which has "some string"so many times, i want it to be replaced with "other string" at all places, using vi or vim editor?
Is there any way to do that?

+1 vote

I am relatively new to shell scripting and UNIX. I am using a Solaris box and the problem is that we have a shell script called strtwrfl.sh which takes a parameter as the workflow name and starts the workflow, e.g. ./strtwrfl.sh ABC where ABC is the workflow name.

I have to run over 200 of such workflows, each workflow is dependent on the successful completion of the previous workflow, i.e. if there are 2 workflows ABC and BCD, strtwrfl.sh BCD will be successful only if strtwrfl.sh ABC successfully executed.

Each workflow takes different time to execute successfully.

I have to write a single shell script such that those 200+ informatica workflows must (I dont mind manually entering those workflows into the script) execute one after another, and if one fails the script should halt displaying which workflow failed.

Since this is a production environment I will not be able to share strtwrfl.sh here.

...