Linux Mastering Development

How to convert all text files in directory to one csv

I want to convert all text files in a directory to one csv file. I want the input to the csv to be the text in the text file labeled by the author of the text file found in the filename. For reference, this is what some filenames look like:

'Winston Churchill___The Crisis, Complete.txt'
'Winston Churchill___The Crossing.txt'
'Winston Churchill___The Dwelling Place of Light, Complete.txt'
'Winston Churchill___The Inside of the Cup, Complete.txt'
'Zane Grey___Betty Zane.txt'
'Zane Grey___Desert Gold.txt'
'Zane Grey___Riders of the Purple Sage.txt'

Example output would be:

column1     column2                     
Author1     test text......   
Author1     test text......   
Author2     test text......
Author2     test text......              

Leave a Reply

Your email address will not be published. Required fields are marked *