How can I extract a predetermined range of lines from a text file on Unix? -


i have ~23000 line sql dump containing several databases worth of data. need extract section of file (i.e. data single database) , place in new file. know both start , end line numbers of data want.

does know unix command (or series of commands) extract lines file between line 16224 , 16482 , redirect them new file?

sed -n 16224,16482p filename > newfile 

from sed manual:

p - print out pattern space (to standard output). command used in conjunction -n command-line option.

n - if auto-print not disabled, print pattern space, then, regardless, replace pattern space next line of input. if there no more input sed exits without processing more commands.

and

addresses in sed script can in of following forms:

number specifying line number match line in input.

an address range can specified specifying 2 addresses separated comma (,). address range matches lines starting first address matches, , continues until second address matches (inclusively).


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -