GIT Bash: How can I select *.txt files? How to split multiple large text into multiple text files?

hello. I want to split multiple large .txt file into multiple .txt files

I use this formula but isn’t working with *.txt

split *.txt MyNewText -b 5m  (it working only one by one: “split bebe.txt MyNewText -b 5m” )
The *.txt should be replace in another syntax. Can you please help me?

First, split is a Linux command, not Git. So you can do man split to get more information.

The split command operates only on a single file. So you need to use Linux’ looping capability.

You can google more for both, but from here is a possible answer:

for f in *.txt; do split $f -b 5m; done

[I don’t have linux running right now so I cannot confirm.]

1 Like


for f in *.txt; do split $f -b 5m; done

@fire-eggs Not working so good, your command selects only one file (random), not multiple files. Don’t know why…