Reputation: 8055
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?
Upvotes: 6
Views: 8096
Reputation: 1337
Try awk
cat mytextfile.txt | awk '{ print $0 > "my_splittet_textfile_"NR".txt"}'
Upvotes: 2
Reputation: 4612
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
Upvotes: 8