I've been doing research for Unix Script these past 2 days. Since I never touch Unix script before and suddenly I need to create Unix script to support my program.
Basically I would like to seek an advise for my case below.
I have a file containing list of Source Filename that I need to load using one of ETL tool.
For example I have
VALID_FILENAME.csv and the content like
test1_file.csv test2_file.csv test3_file.csv
I want to duplicate them into 3 parts, since I’ll have Header, Details and Trailer for each.
My expectation is I will duplicate
VALID_FILENAME.csv into 3 files and name them
The content also I’ll replace so it will be like this below.
test1_file_H test2_file_H test3_file_H
test1_file_D test2_file_D test3_file_D
test1_file_T test2_file_T test3_file_T
My question is whether it's possible for me only use cp and rename the files to duplicate
VALID_FILENAME.csv to 3 another files? And whether it's also possible to use sed to replace .csv to either H/D/T?
Why I need to separate them into 3 parts is because my ETL tool program will process Header, Detail and Trailer in seperate flow.
Appreciate any suggestions or opinions on what is the best approach to duplicate file, rename it to different name and replace the string inside the file in Unix.