I have a shell script to modify that was produced by a.n.other. If it was perl I could do it with no problems, but my shell scripting knowledge is not up to the task. I think I'll need to use awk, hence this posting.
I have a directory, the top few entries in it being subdirectories called:
history/
exceptions/
070221/
070220/
070219/
The script uses the output of:
to provide me with yesterday's subdirectory i.e. 070220.
This works fine except when someone has been testing and the top few entries become:
history/
exceptions/
070221/
070220tests/
070220/
070219/
The script fails if '070220tests/' is returned.
I always want to receive the second all-numeric entry i.e 070220 in the above list.
Can this be done using awk?
I have a directory, the top few entries in it being subdirectories called:
history/
exceptions/
070221/
070220/
070219/
The script uses the output of:
Code:
ls -1r /directory_name | head -4 | tail -1
to provide me with yesterday's subdirectory i.e. 070220.
This works fine except when someone has been testing and the top few entries become:
history/
exceptions/
070221/
070220tests/
070220/
070219/
The script fails if '070220tests/' is returned.
I always want to receive the second all-numeric entry i.e 070220 in the above list.
Can this be done using awk?