With the given input, $3 (when using _ as the field separator) is always 0 in the sample input. I think changing $3 to $2 will yield what emily requested, i.e.,
assuming, of course, that the filenames in the list will always have the same format.
With the given input, $3 (when using _ as the field separator) is always 0 in the sample input. I think changing $3 to $2 will yield what emily requested, i.e.,
assuming, of course, that the filenames in the list will always have the same format.
As OP's input file
Quote:
Originally Posted by emily
$3 only give numeric digits on which OP is trying to get desired output...
Originally Posted by Don Cragun
With the given input, $3 (when using _ as the field separator) is always 0 in the sample input. I think changing $3 to $2 will yield what emily requested, i.e.,
assuming, of course, that the filenames in the list will always have the same format.
As OP's input file
Quote:
Originally Posted by emily
$3 only give numeric digits on which OP is trying to get desired output...
Yes. Sorry. I missed the underscore in the group name.
Note, however, that the input you quoted from emily's original post is not just the output of an ls -l command. In the original post, the input specified was:
with no indication of how the 518t, 519t, or 520t was prepended to the ls output. I had originally thought we might be able to find a solution matching on the numeric digits at the start of the line instead of on part of the filename and assuming that the group name would be a constant (or at least always contain an underscore). In a later post, emily listed an input file that just looked like ls -loutput, but the nnnt magically appeared at the front of the output she said she got by running your command on that input. So I'm still not sure what the real format is for input lines and I don't know what we can count on being consistent in the log files to be processed. Oh, well!
Hi,
I need to delete 3 month old files in my logpath. This path contains several logs and other important files
The file names are be like this
sl_details.env
tomcatfiles_03062014.log
application_zur_03.062014.log
I need to delete only tomcatfiles logs. I wrote this command.
can... (7 Replies)
Hi,
The other day i installed a PHP based CMS (modx) on my shell account and noticed that i couldn't delete any of files/dirs it created after.
Also, i noticed that all that stuff is owned by username-www instead of username.
I tried chown, chmod and using a PHP script to do the same wti... (4 Replies)
Hi All,
how can Periodical Delete files and folders using shell script.
I.e after 1 min i want to delete files and folderns from my home directory.
Thanks,
Arun (9 Replies)
Hi i need an help. I have two files list1 and list2, both contains the server names i want to delete the servers in list2 which were also found in list1.
for an eg
list2 list1
oradg1 oradg4
oradg2 oradg2
oradg3 ... (5 Replies)
Hi, everyone. Could you help me with deletion of files, which are 20 minutes old.
I found out how to make deletion for files in that way :
find <dir> -mtime n -exec rm -rf "{}"
Could you offer your suggestions.
Many thanks in advance. (5 Replies)
Hi, This is possibly an odd request to do with permissions as I seem to have tied myself up with these!
I have the following directory (see below) that contains files that the 'usergrp' user needs to be able to 'delete' files from.
drwxr-s--- 2 usergrp usergrp 512 16 Feb 14:37... (2 Replies)
Hello Friends,
I want to delete all the "*.trg" files in a directory but i don't want to do it by
system("rm -r *.trg");
Can i do it thru unlink or by any other mean
Thanks,
Pulkit (1 Reply)
Hi,
I have a folder with limited space. I do not have provisions to increase the space for this folder.
So i have to delete files which are more than 1 month old automatically.
But, i need to maintain the files created by 4 users and delete all the other files automatically which is more than 1... (4 Replies)
We have log files dating back to 2004. I need to write an interative script that will request the user for how many months he needs to keep the log files and remove all the remaing log files after that month.
Supposing we are now in June 2006 , if teh user request to keep log file for the last 3... (1 Reply)
Hi,
I have a list of directories which contain old files that are to be deleted.
I put the list of all directories in a txt file and it is being read by a script
Iam searching for the files older than 60 days using mtime and then deleting it
But all the files are getting deleted... (3 Replies)