Issue
i have a big text file with lines:
Gen.1.1 in the beginning...
Gen.1.2 and earth was...
Rev.22.20 he talks...
i would like to split the file by line, where the filename should be the first string.
gen.1.1.txt should contain:
Gen.1.1 in the beginning...
gen.1.2.txt should contain:
Gen.1.2 and earth was...
rev.22.20.txt should contain:
Rev.22.20 he talks...
i've already tried the basic split (of course, file name is not ideal):
awk '{print > substr($0, 0, 1)}' file
Solution
Try using:
awk '{ print >> $1".txt" }' myfile; close($1".txt") }
edited (incorporated comment by OP suggesting file should be included)
Answered By - SMA Answer Checked By - Senaida (WPSolving Volunteer)