08-11-2005
How to pattern match on digits and then increment?
I have a log file that ends in a ".xxx" where xxx are digits but I don't necessarily know what digits they are. The log file rotates automatically and is auto-incrementing - starting at .001.
So the example would be:
file-name.005
If the file ends in .005 and the log rotates, it logically rotates to "file-name.006". But, not knowing the original number it could be auto-incrementing to any number.
So I am hoping someone can tell me what tools to use and how to 'know' that the log file ends in 005 and from this pattern, know that the next log file must end in 006 (vs. just the digit 6).
Thanks in advance!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guys,
I have a text file report generated from egrepping multiple files.
The text files themselves are obtianed after many succesive refinements, so they contain already the desired number, but this is surrounded by unwanted characters, newlines, spaces, it is not always at the start of the... (6 Replies)
Discussion started by: netfreighter
6 Replies
2. Shell Programming and Scripting
My input file:
<accession>Q91G55</accession>
<name>043L_IIV6</name>
<protein>
<recommendedName>
<location>
<position position="294"/>
</location>
<fullName>Uncharacterized protein 043L</fullName>
<accession>P18556</accession>
<name>1106L_ASFB7</name>
<protein>
<recommendedName>... (5 Replies)
Discussion started by: patrick87
5 Replies
3. UNIX for Advanced & Expert Users
Hello,
I need to construct a pattern to match the below string (especially the timestamp at the beginning)
20101222100436_temp.dat
The below pattern works _temp.dat
However I am trying find if there are any other better representations.
I tried {14}, but it did not work.
I am on... (5 Replies)
Discussion started by: krishmaths
5 Replies
4. Shell Programming and Scripting
hi all, im having problems. I need to change all number 10 in a text file to word form, or in short from 10->ten. the thing is number 10 including in dates such as 10/22/1997 or 03-10-2011 should not be changed. im having some trouble because the file contains numbers like "price range from... (11 Replies)
Discussion started by: perlishell
11 Replies
5. Shell Programming and Scripting
Hi,
I just need to check whether number of digits in a phone number is 10 or not. If I am not wrong regex will be: {9}
I have to use this inside nawk as this is a small portion of a big program.
nawk '
BEGIN { RS="";FS=";";
regex="{9}";
}
{
for (i=1;i<=NF;i++) {
if... (6 Replies)
Discussion started by: shekhar2010us
6 Replies
6. Shell Programming and Scripting
i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies
7. UNIX for Dummies Questions & Answers
Hi experts , im new to Unix,AWK ,and im just not able to get this right.
I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Discussion started by: 100bees
2 Replies
8. Shell Programming and Scripting
Im using the command below , but thats not the output that i want. it only prints the odd and even numbers.
awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}'
Im hoping for something like this
file1:
Text hi this is just a test
text1 text2 text3 text4 text5 text6
Text hi... (2 Replies)
Discussion started by: invinzin21
2 Replies
9. Shell Programming and Scripting
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies
10. UNIX for Dummies Questions & Answers
Trying to find out how to discover if the first 2 characters of a string are "22"
Not sure how.
I could use
if ]; then echo "yes";fi
But I think that will only grab the pattern 22 and not the first 2 digits. (5 Replies)
Discussion started by: newbie2010
5 Replies
LEARN ABOUT DEBIAN
plsyax
PLSYAX(3plplot) PLplot API PLSYAX(3plplot)
NAME
plsyax - Set y axis parameters
SYNOPSIS
plsyax(digmax, digits)
DESCRIPTION
Identical to plsxax(3plplot), except that arguments are flags for y axis. See the description of plsxax(3plplot) for more detail.
Redacted form: plsyax(digmax, digits)
This function is used in examples 1,14,31.
ARGUMENTS
digmax (PLINT, input)
Variable to set the maximum number of digits for the y axis. If nonzero, the printed label will be switched to a floating point
representation when the number of digits exceeds digmax.
digits (PLINT, input)
Field digits value. Currently, changing its value here has no effect since it is set only by plbox(3plplot) or plbox3(3plplot).
However, the user may obtain its value after a call to either of these functions by calling plgyax(3plplot).
AUTHORS
Geoffrey Furnish and Maurice LeBrun wrote and maintain PLplot. This man page was automatically generated from the DocBook source of the
PLplot documentation, maintained by Alan W. Irwin and Rafael Laboissiere.
SEE ALSO
PLplot documentation at http://plplot.sourceforge.net/resources.
August, 2012 PLSYAX(3plplot)