Aswex
February 16, 2011, 10:01am
1
Hello,
Sorry for the poor tilte but I still don't know how to this.
Here is my problem.
I have to huge log file. In this log file I can know where is stored all my files. As I have to get a reporting of of files I only need to keep the file name but I don't know how to do it. I hope you will be hable to help me.
Here is what I have
/OPERATIONNEL/SAT/MONDES/PHY/SAT_LOG_PLMPRC8_NOW_20101110_20101117_R20101117
/OPERATIONNEL/SAT/MONDES/OLD/SAT_LOG_PLMPRC_FORE_20101117_20101201_R20101117
/OPERATIONNEL/SAT/MONDES/TMP/SAT_LOG_PLMPR_HIND_20101103_20101110_R20101117
/OPERATIONNEL/SAT/MONDES/TMP/OLD/LAST/SAT_LOG_PLMPR_NOW_20101110_20101117_R20101117
/OPERATIONNEL/SAT/MONDES/SAT_MONDES_FOR_20110126_20110209_R20110126.TAR
/OPERATIONNEL/SAT/MONDES/SAT_MONDES_FOR_20110112_20110119_R20110126.TAR
Here is what I am looking for
SAT_LOG_PLMPRC8_NOW_20101110_20101117_R20101117
SAT_LOG_PLMPRC_FORE_20101117_20101201_R20101117
SAT_LOG_PLMPR_HIND_20101103_20101110_R20101117
SAT_LOG_PLMPR_NOW_20101110_20101117_R20101117
SAT_MONDES_FOR_20110126_20110209_R20110126.TAR
SAT_MONDES_FOR_20110112_20110119_R20110126.TAR
Thanks for your help
joeyg
February 16, 2011, 10:11am
3
$ cat sample8.txt
/OPERATIONNEL/SAT/MONDES/PHY/SAT_LOG_PLMPRC8_NOW_20101110_20101117_R20101117
/OPERATIONNEL/SAT/MONDES/OLD/SAT_LOG_PLMPRC_FORE_20101117_20101201_R20101117
/OPERATIONNEL/SAT/MONDES/TMP/SAT_LOG_PLMPR_HIND_20101103_20101110_R20101117
/OPERATIONNEL/SAT/MONDES/TMP/OLD/LAST/SAT_LOG_PLMPR_NOW_20101110_20101117_R20101117
/OPERATIONNEL/SAT/MONDES/SAT_MONDES_FOR_20110126_20110209_R20110126.TAR
/OPERATIONNEL/SAT/MONDES/SAT_MONDES_FOR_20110112_20110119_R20110126.TAR
$ awk -F'/' '{print $NF}' <sample8.txt
SAT_LOG_PLMPRC8_NOW_20101110_20101117_R20101117
SAT_LOG_PLMPRC_FORE_20101117_20101201_R20101117
SAT_LOG_PLMPR_HIND_20101103_20101110_R20101117
SAT_LOG_PLMPR_NOW_20101110_20101117_R20101117
SAT_MONDES_FOR_20110126_20110209_R20110126.TAR
SAT_MONDES_FOR_20110112_20110119_R20110126.TAR
1 Like
Aswex
February 16, 2011, 10:18am
4
Thanks you so MUCH ...
But know, do you think it's possible to sort the result to get the file sort by date ?
In fact at the end of each file the RDATE means the date of the running product.
I need to get the result also by date .
Thanks
nawk -F/ '
{
match($NF,"_R[0-9][0-9]*")
print substr($NF,RSTART+2,RLENGTH-2), $NF
}' myFile | sort -n -k1,1 | cut -d ' ' -f2-
1 Like
Aswex
February 17, 2011, 6:39am
6
Thanks. All codes worked fine.