Reputation
51,203
Next tag badge:
398/400 score
158/80 answers
Badges
7 66 141
Impact
~2.1m people reached

4h
awarded  Nice Question
22h
revised Loop is not working as it should
edited tags
23h
comment Dealing with if statement
@buddhasreekanth not really. You are checking different things and want three separate outcomes depending on the situation. See updated answer for a more concise version.
23h
revised Dealing with if statement
added 471 characters in body
23h
comment I need to copy lines from multiple files between two dates with date name as file extension
@Hemanthvarma I don't know. How could I know? You ignore my requests to add information to your question so that I can actually see your data and help you. If you had edited your question as requested, we would have solved this by now. Please don't comment again unless you have added information to your question.
23h
answered Dealing with if statement
23h
comment Dealing with if statement
If the answers you received to your previous question answered that question, please accept one. That way, the question can be marked as solved.
1d
revised Dealing with if statement
added 67 characters in body; edited tags
1d
comment I need to copy lines from multiple files between two dates with date name as file extension
@Hemanthvarma yes. I know. In order to debug this, instead of using dialog, just use a fake tmp file. That way, we have fewer variables to check and everything is easier. I can't know if the error is i) in dialog; ii) in saving to the tmp file; iii) in reading the tmp file; iv) in the date conversion; iv) anywhere else. When debugging, you always need to simplify to the simplest possible example that reproduces your error.
1d
comment I need to copy lines from multiple files between two dates with date name as file extension
@Hemanthvarma why is this so hard for you? I can't read the format in the comments. Just edit your question and add any extra detail there. You are using dialog and have a relatively complicated setup. The best thing for you to do is make a minimal example, where the contents of the temp files are predefined and show us that. Just create a file with the date you want and see if awk can deal with it.
1d
comment I need to copy lines from multiple files between two dates with date name as file extension
@Hemanthvarma you should probably quote $dat1 and $dat2 in the date commands: edt=$(date +%j -d "$dat2"). To be sure, we would need to see the contents of the tmp.$$ files. Why don't you add some echo statements and see what $dat1 and $dt1 actually contain? Are they what you think they are?
1d
comment I need to copy lines from multiple files between two dates with date name as file extension
@Hemanthvarma did you use the awk command from my answer? That is equivalent to grep -E "$dat1|$dt1". In any case, why not just use grep if that worked?
1d
comment I need to copy lines from multiple files between two dates with date name as file extension
As we have told you so, so many times, do not add information in comments, edit your question instead. Anyway, my answer should solve your issue. Next time, please include everything in the question and not in comments.
1d
answered I need to copy lines from multiple files between two dates with date name as file extension
1d
revised I need to copy lines from multiple files between two dates with date name as file extension
added 283 characters in body
1d
comment I need to copy lines from multiple files between two dates with date name as file extension
Please stop adding information in the comments. Everything should go directly into your question. Thanks for showing us the script, now could you please add an example of your input file so we know what you're parsing and an example of your desired output so we know what you want it to look like?
1d
revised I need to copy lines from multiple files between two dates with date name as file extension
added 160 characters in body
1d
comment I need to copy lines from multiple files between two dates with date name as file extension
For the third time, add an example of your input file and your desired output.
1d
comment I need to copy lines from multiple files between two dates with date name as file extension
@Hemanthvarma add it into your question. More importantly (since your script really has very many errors), show us your input file and your desired output.
1d
comment I need to copy lines from multiple files between two dates with date name as file extension
Please show us your entire script. Where is dat1 defined? Never use for i in $(ls), that will break on any type of non-standard file name. Your $dat1 is not available to awk. Please edit your question, show us an example of your input file and the output you want to have from it.