Extract line from a file in shell script -


i have text file of 5000000 lines , want extract 1 line each 1000 , write them new text file. new text file should of 5000 line.

can me?

you can use either head or tail, depends line you'd extract.

to extract first line each file (for instance *.txt files):

head -n1 *.txt | grep -ve ^= -e ^$ > first.txt 

to extract last line each file, use tail instead of head.

for extracting specific line, see: how use head , tail print specific lines of file.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -

html - href attribute breaking an element -