Delete files based on specific MMDDYYYY pattern in filename
Hi Unix gurus,
I am trying to remove the filenames based on MMDDYYYY in the physical name as such so that the directory always has the recent 3 files based on MMDDYYYY. "HHMM" is just dummy in this case. You wont have two files with different HHMM on the same day.
For example in a directory, I have files like
When I run the script it should delete the OPEN_INV_01012011_1345.xls and OPEN_INV_01012011_3456.txt
Note that the before the file extension, we always have "MMDDYYYY_HHMM"
I am using the following script:
This is what I am trying to do;
Any help is greatly appreciated.
Thanks
Last edited by Scott; 08-09-2011 at 01:04 PM..
Reason: Added code tags
I have one file which is having content as following...
0513468211,,,,20091208,084005,5,,2,3699310,
0206554475,,,,20090327,123634,85,,2,15615533
0206554475,,,,20090327,134431,554,,2,7246177
0103000300,,,,20090523,115501,89,,2,3869929
0736454328,,,,20091208,084005,75,,2,3699546... (7 Replies)
My files look like this
And I need to cut the sequences at the last "A" found in the following 'pattern' -highlighted for easier identification, the pattern is the actual file is not highlighted.
The expected result should look like this
Thus, all the sequences would end with AGCCCTA... (2 Replies)
Hi, just tried some script, awk, sed for the last 2 hours and now need help.
Let's say I have a huge file of 800,000 lines like this :
It's a tedious job to look through it, I'd like to remove those useless lines in it as there's a few thousands :
Or to be even more precise :
if line1 =... (6 Replies)
I'm looking for what I hope might be a one liner along these lines:
sed '/a line with more than 3 pipes in it/d'
I know how to get the pipe count in a string and store it in a variable, but I'm greedy enough to hope that it's possible via regex in the /.../d context. Am I asking too much? ... (5 Replies)
Hi all,
I have been trying to delete duplicates based on a certain pattern but failed to make it works. There are more than 1 pattern which are duplicated but i just want to remove 1 pattern only and remain the rest. I cannot use awk '!x++' inputfile.txt or sed '/pattern/d' or use uniq and sort... (7 Replies)
I have some text files in a folder named ff as follows. I need to delete the lines (in-place editing)in these files based on another file aa.txt.
32bm.txt:
249 253 A P - 0 0 8 0, 0.0 6,-1.4 0, 0.0 2,-0.4 -0.287 25.6-102.0 -74.4 161.1 37.1 13.3 10.9
250... (2 Replies)
Hi all,
I am a newbie here. I have this requirement to find a file based on a pattern then return the filename if found.
I created a script based on online tutorials. Though, I am stuck & really appreciate if anyone can have a quick look & point me to the right direction?
#Script starts... (10 Replies)
Gents,
I am trying to delete all lines which start with "H" character, but keeping the fist header. Example In the input file I will delete all lines starting from line 8 which contents character "H" to the end of the file.
I try
sed '8,10000{/^H/d;}' file
But as don't know the end... (1 Reply)
BASH in Solaris 10
I have a log file like below. Whenever the pattern ORA-39083 is encountered, I want to delete the line which has this pattern and 3 lines below it.
$ cat someLogfile.txt
ORA-39083: Object type OBJECT_GRANT failed to create with error:
ORA-01917: user or role 'CMPA' does... (4 Replies)
Discussion started by: kraljic
4 Replies
LEARN ABOUT REDHAT
hexbin
HEXBIN(L) HEXBIN(L)
NAME
hexbin - Macintosh file de-binhexer
SYNOPSIS
hexbin [ - options ] [ files ]
DESCRIPTION
hexbin takes the text files specified in files (or standard input if none is specified) and converts them subject to the options specified.
OPTIONS
In the absence of any options, hexbin takes the specified files and silently converts them into MacBinary format, giving the output files
".bin" extensions and placing them in the current working directory.
-3 Write files in fork format (.info, .data and .rsrc files.)
-f As -3, but empty data and rsrc files are not created.
-r Write resource forks only (.rsrc files.)
-d Write data forks only (.data files.)
-u As -d, but the codes for CR and LF are interchanged, the filename extension is .text.
-U As -u, but there is no filename extension.
-a Write files in AppleShare format. This option is only valid if the program is compiled with support for some form of AppleShare.
The current directory must be a valid AppleShare folder.
-s Write extracted files to standard output in MacBinary format.
-l List every file extracted (and every directory/folder created etc.)
-v Like -l, but more verbose. When this option is specified all lines skipped because they do not belong to the hexified format are
listed (implies -l.)
-i Do not convert, give information only (implies -l.)
-c Do not check whether the hexified lines have equal size. Normally the hexifiers gives text files with equal length line size,
hexbin uses this in its heuristics to determine whether a line must be skipped. There are however hexified files that do not con-
form to that pattern. If this option is specified hexbin will in general be unable to detect whether a line is garbage or not, so
you have to remove the garbage by hand.
-n name
Gives the Unix base file name for the converted files. For files hexified with BinHex 4.0 or compatible hexifiers this flag is not
needed; hexbin will determine the Unix file name based on the Mac file name. For files in dl, hex or hcx format this parameter may
be needed as these formats do not include the Mac filename. Normally hexbin will in those cases base the Unix file name on the text
file name, but that can be overruled with this parameter.
-V Gives the patchlevel of the program, and other information. Other options are ignored and the program quits immediately.
-H Give short information about the options. Other options are ignored and the program quits immediately.
BUGS
As this is a beta release, there may still be some problems.
SEE ALSO macutil(1)AUTHOR
Dik T. Winter, CWI, Amsterdam, The Netherlands (dik@cwi.nl)
Parts of the code are based on codes from: ahm (?), Darin Adler, Jim Budler, Dave Johnson, Dan LaLiberte, Jeff Meyer, Guido van Rossum.
3rd Berkeley Distribution October 22, 1992 HEXBIN(L)