Loading...

Splitting a file and its lines under Linux/bash

Answer #1 75 %

Homework? :-)

I would think that a simple pipe with sed (to split each line into two) and split (to split things up into multiple files) would be enough.

The man command is your friend.


Added after confirmation that it is not homework:

How about

sed 's/\(.....\)\(.....\)/\1\n\2/' input_file | split -l 2000000 - out-prefix-

?

You’ll also like:


© 2022 CodeForDev.com -