![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| part of a filename | flame_eagle | Shell Programming and Scripting | 8 | 02-28-2008 11:18 AM |
| Find and store files based on FileName and Modified Time | edisonantus | UNIX for Advanced & Expert Users | 2 | 02-19-2008 02:25 PM |
| how to move files into different folders based on filename | italia5 | UNIX for Dummies Questions & Answers | 7 | 08-23-2006 11:04 AM |
| how to print part of report ? | Golive | HP-UX | 2 | 06-22-2005 11:29 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Report of duplicate files based on part of the filename
I have the files logged in the file system with names in the format of : filename_ordernumber_date_time
eg: file_1_12012007_1101.txt file_2_12022007_1101.txt file_1_12032007_1101.txt I need to find out all the files that are logged multiple times with same order number. In the above eg, I need to get a report like: file_1: Submitted two times at 12012007_1101 , 12032007_1101 |
|
||||
|
Quote:
Code:
ls *.txt |
awk -F"_" '{
split($4, a, ".")
num[$2]++
ord[$2]=$3"_"a[1]
} END {
for (i in ord)
if (num[i] > 1)
print "file_"i": Submitted "num[i]" times "ord[i]
}'
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|