Create file with date and information Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Create file with date and information without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I want to create a file in a shell script. The file’s name should be:


Where datetoday is today’s date in YYYYMMDD format. The contents of the file should be:


That is, one line with the name of the file, the system date and the number of records from another file.



So, the contents of the generated file would be:

MyFile_20160527.dat;2016/05/27 00:00;3

How can I do that?


I think you are looking for this:

fname=MyFile_"$(date +%Y%d%M)".dat
echo "$fname;$(date +%D);$(wc -l < anotherfile.dat )" > "$fname"
We are here to answer your question about Create file with date and information - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji