I have a text file with 30 lines. I would like to split it up by line where each line will be in a new text file.
I used this command in the command line but didnt get any useful output except the exact same 30 line file but just renamed as "xaa" :
split -l 1 mytextfile.txt
Am i doing something wrong here?
You're using the -l
argument incorrectly. The value you pass in with -l
is the number of lines to put into each piece. So you're taking a 30 line file and splitting into ... a single 30 line file.
You need to do split -l 1 mytextfile.txt
Try awk
cat mytextfile.txt | awk '{ print $0 > "my_splittet_textfile_"NR".txt"}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With