Skip to content
Advertisement

vi command to copy certain lines to another file

I have a log file with thousands of lines. I want to copy certain logs ranging between two line numbers to another file so that I can share them within team.

For example – I want to copy text from line number 1000 to line 1200 to another file say issueLog.log

What is the shortest way to do this?

Note: We are not using vim.

Advertisement

Answer

Open the original file in Vi and type the following command.

JavaScript

(or)

Use GNU sed

JavaScript

(or)

Use perl

JavaScript

(or)

Use awk

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement