Open /home/bob/testfile file in any editor task number 11

has anyone here had any luck with any of the vim “vi” tasks? this task asked for the following:

Open /home/bob/testfile file in any editor (vi, nano etc) and move line present on line no:1049 to line no: 5 .

when I opened the file in vi and go to the line 1049 by pressing :1049 and copy the content by pressing yy than again going back to line number 5 by pressing :5 and pasting the content by pressing p I can clearly see the content being pasted, than I quit and save by pressing :wq! the task fails

The task says move. You wrote copy.

looks like you pasted on line 6, not line 5

yy is copy - so it will be wrong no matter where he pastes a copy

The task says move - so cut and paste.

Hello guys, thank you all for your prompt responses and feedback, so this is still not working, this is what I am doing:

moving to line 1049 by doing the following - :1049 and it takes me to the line where it says “you found me” than I do YY and it cuts the line, immediately I go to line number 5 by doing :5 and pasting “P” into line number 5 which seems to work but when I click the check button it says it has not being moved, any suggestions?

thanks in advance

yy is copy - you need to cut

cut command is not yy

Also count the lines from 1 to 6 and see where the line you pasted is.

just tried it again,

moved to line 1049 by typing :1049
cut the line by typing dd
moved to line 5 by typing :clock5:
pasted it by typing p

still not working

I’d do it this way:

  • Type :set nu<CR> so you can see the line numbers.
  • type <esc>1049G
  • dd
  • 4G
  • put the cursor at the end of line 4
  • p

Thanks rob, I guess the trick was to put the cursor at the end of the line number 4 and pasting, it works now.

Thanks everybody for the support and all the suggestions.