08-27-2002
Realize scripting is just putting into a file what you would do manually (but adding the 'thinking' part - the logic to delete only those files - is the hard part).
You could take your command and put it in a script to collect the file names, and then loop through them and delete. You would have to pull out the last piece of the ls -lt (after confirming it to be in the range you want to delete) and delete it.
You also have to watch out that the file you are going to delete isn't a directory, that you set yourself into the correct directory...
Your first step, finding your files is coverend in your command:
ls -lt | grep "Aug 26" | grep 11:14
Put that into an awk statement to print the last portion of the string (the filename), check that it is a text file (or whatever) and not a directory, special, link, ... file, then delete it.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Folks;
I'm trying to write a script to scan through a directory tree then for each file it finds, it run a command line tool, then if the results include the word "DONE", it removes the file.
In more details;
i have a Linux directory tree such as "/opt/grid/1022/store"
I'm trying to write a... (6 Replies)
Discussion started by: Katkota
6 Replies
2. Shell Programming and Scripting
Hi Everyone,
# cat 1
a
b b
cc
1
2
3 3 3
4
55 5
a
b (2 Replies)
Discussion started by: jimmy_y
2 Replies
3. Shell Programming and Scripting
Hi,
I need to remove some lines from an XML file is the value within a tag is empty.
Imagine this scenario,
<acd><acdID>2</acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
I... (3 Replies)
Discussion started by: giles.cardew
3 Replies
4. Shell Programming and Scripting
Hi
Ive been scratching over this for some time with no solution.
I have a file like this
1 bla bla 1
2 bla bla 2
4 bla bla 3
5 bla bla 1
6 bla bla 1
I want to remove consecutive occurrences of lines like bla bla 1, but the first column may be different.
Any ideasss?? (23 Replies)
Discussion started by: jamie_123
23 Replies
5. Shell Programming and Scripting
hi to all
Does anyone know if there's a way to remove duplicate lines which we consider the same only if they have the first and the second column the same?
For example I have :
us2333 bbb 5
us2333 bbb 3
us2333 bbb 2
and I want to get
us2333 bbb 10
The thing is I cannot... (2 Replies)
Discussion started by: vlm
2 Replies
6. Shell Programming and Scripting
Hi Gents,
Please can you help me to get the desired output .
In the first column I have some duplicate records, The condition is that all need to reject the duplicate record keeping the last occurrence. But the condition is. If the last occurrence is equal to value 14 or 98 in column 3 and... (2 Replies)
Discussion started by: jiam912
2 Replies
7. UNIX for Dummies Questions & Answers
Hi Masters,
I need to remove lines when date format is below certain date
My file input
20140906|ALASKA|USASEL|TARPUNG|2014-03-01|82176614040|20|1
20140906|ALASKA|USATENG|CRUIEX|2014-08-01|81267079997|5|0
20140906|ALASKA|USASEL|CRUIEMBANG|2013-10-01|82280779814|9|0... (4 Replies)
Discussion started by: radius
4 Replies
8. Shell Programming and Scripting
In the following tab-delimited input, I am checking $7 for the keyword intronic. If that keyword is found then $2 is split by the . in each line and if the string after the digits or the +/- is >10, then that line is deleted. This will always be the case for intronic. If $7 is exonic then nothing... (10 Replies)
Discussion started by: cmccabe
10 Replies
9. Shell Programming and Scripting
Gents,
Is there the chance to remove part of the file,
Taking in consideration this condition.
For each record the first row start with the string % VE
should be 56 rows for each records..
first row = % VE
last row = % sw
total 56 rows for each record.
Then in the case that the... (4 Replies)
Discussion started by: jiam912
4 Replies
10. UNIX for Beginners Questions & Answers
Hi Experts,
we have a requirement , need your help to remove the footer record in the file.
Input file :
1011070375,,21,,NG,NG,asdfsfadf,1011,,30/09/2017,ACI,USD,,0.28,,,,,,,,,,,,
1011070381,,21,,NG,NG,sgfseasdf,1011,,30/09/2017,ACI,GBP,,0.22,,,,,,,,,,,,... (6 Replies)
Discussion started by: KK230689
6 Replies
LEARN ABOUT HPUX
ipsec_config_delete
ipsec_config_delete(1M) ipsec_config_delete(1M)
NAME
ipsec_config_delete - delete configuration records from the HP-UX IPSec configuration database and delete certificate files
SYNOPSIS
object_name
ip_addr
object_name
object_name
object_name
object_name
DESCRIPTION
The command deletes configuration records from the configuration database and certificate data. If HP-UX IPSec is active and running, the
data (IPsec policy, authentication record or bypass list entry) is also deleted from the runtime policy database. If you delete IPsec
policies that have active Security Associations (SAs), HP-UX IPSec removes the SAs from the Security Association Database (SADB) and sends
a delete notification to the remote system. If HP-UX IPSec removes an IKE policy, the associated IPSec SAs can remain active, but no IKE
control messages can be sent.
The command deletes the certificate for the local system and the related private key file from the directory. It does not delete certifi-
cates for CAs or Certificate Revocation Lists (CRLs). To delete these objects, you must manually delete the files in the directory. You
can use the command to display the file names with the subject names for the CA certificate files and the issuer names for the CRL files.
You cannot delete the configuration object.
Options and Operands
The command recognizes the following options and operands:
object_name
Specifies the name of the object you are deleting.
Do not use this argument when deleting a configuration object.
You cannot delete the host, IKEv1, or IKEv2 policies.
ip_addr
Specifies the IP address of the entry in the bypass list you are deleting.
EXAMPLES
The following command deletes the host IPsec policy named
AUTHOR
was developed by HP.
FILES
configuration database.
default profile file.
SEE ALSO
ipsec_admin(1M), ipsec_config(1M), ipsec_config_add(1M), ipsec_config_batch(1M), ipsec_config_export(1M), ipsec_config_show(1M),
ipsec_migrate(1M), ipsec_policy(1M), ipsec_report(1M).
HP-UX IPSec Software Required ipsec_config_delete(1M)