Use matching value of a RegExp to name the output file.
- by fx42
I have this file "file.txt" which I want to split into many smaller ones.
Each line of the file has an id field which looks like "id:1" for a line belonging to id 1.
For each id in the file, I like to create a file named idid.txt and put all lines that belong to this id in that file.
My brute force bash script solution reads as follows.
count=1…