shell - How to include variable to output filename using awk -
is a command that prints the file from the CSV file to the extent of the range:
< Code> Date1var = mm / dd / yyyy hh: mm: ss date2var = mm / dd / yyyy hh: mm: ss awk -F, -v d1var = "$ date1var" -v d2var = "$ date2var" '$ 1 & Gt; D1var & amp; Amp; $ 1 & lt; = D2var {print $ 0} 'OFS =, plot_data.csv & gt; Graph1.csv
I'm guessing is it possible to include my variable in the output filename?
The last name of the file should be the same:
graph_d1var-d2var.csv
Any ideas?
Let the shell handle it: you're starting with the shell variable after all
date1var = mm / dd / yyyy hh: mm: ss date2var = mm / dd / yyyy hh: mm: ss awk -F, -v OFS =, -v d1var = "$ date1var" \ -v D2var = "$ date2var" \ '# awk script is unchanged' plot_data.csv & gt; "Article 1 _ $ {date1var} - $ {date2var} .csv"
Comments
Post a Comment