last month's logfile


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting last month's logfile
# 1  
Old 06-26-2007
last month's logfile

hi friends
I need a shell script which will do the following Task

Enter the month :
if you enter 1 then it ll show you last 1 month's (starting from today).log file in the current directry.
if you enter 4 then it ll show you last 4 month's (starting from today).log file in the current directry
like wise for n .....

Thanks in advance!!
# 2  
Old 06-26-2007
Something like this?

Code:
echo "how many months back "
read month


while [ ${month} -ne 1 ]; do
        let month=month-1
        cat "$month".log
done

# 3  
Old 06-26-2007
Dear Deep_kol,

Have you tried anything on your own ?? Could you show it to us so that we can check it and suggest further steps ?

Mr. Earnstaf - Have a close look at his requirement, its not so simple Smilie
kamitsin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Logfile monitoring with logfile replacement

Bonjour, I've wrote a script to monitor a logfile in realtime. It is working almost perfeclty except for two things. The script use the following technique : tail -fn0 $logfile | \ while read line ; do ... some stuff done First one, I'd like a way to end the monitoring script if a... (3 Replies)
Discussion started by: Warluck
3 Replies

2. Shell Programming and Scripting

Need last month files after 10th of every month

Hi, I need all file names in a folder which has date >= 10th of last month, Example : files in folder AUTO_F1_20140610.TXT BUTO_F1_20140616.TXT CUTO_F1_20140603.TXT FA_AUTO_06012014.TXT LA_AUTO_06112014.TXT MA_AUTO_06212014.TXT ZA_AUTO_06232014.TXT Output: AUTO_F1_20140610.TXT... (9 Replies)
Discussion started by: nani1984
9 Replies

3. Shell Programming and Scripting

How to add decimal month to some month in sql, php, perl, bash, sh?

Hello, i`m looking for some way to add to some date an partial number of months, for example to 2015y 02m 27d + 2,54m i need to write this script in php or bash or sh or mysql or perl in normal time o unix time i`m asking or there are any simple way to add partial number of month to some... (14 Replies)
Discussion started by: bacarrdy
14 Replies

4. Shell Programming and Scripting

Convert From Month Number to Month Name

Hi, I have a script that accepts an input date from the user in yyyy-mm-dd format. I need to get the mm-dd part and convert it to month name. example: 2011-11-15 I want that to become "Nov 15" I don't have the GNU date, I am using an AIX os. Thanks. (1 Reply)
Discussion started by: erin00
1 Replies

5. Shell Programming and Scripting

Script to counting a specific word in a logfile on each day of this month, last month etc

Hello All, I am trying to come up with a shell script to count a specific word in a logfile on each day of this month, last month and the month before. I need to produce this report and email it to customer. Any ideas would be appreciated! (5 Replies)
Discussion started by: pnara2
5 Replies

6. Shell Programming and Scripting

looking for string in logfile

I have a shell script that used to look for a particular sting in the last line of a log file. Howeve this string now has moved to the 3rd or 4th line from bottom. Can anyone point me to how i easiest chage this one to look within the last frew lines (5 or so) for the particular string rather... (6 Replies)
Discussion started by: jjlinux
6 Replies

7. UNIX for Dummies Questions & Answers

change value of logfile

Hi, I have a log file like exyymmdd.log and i need to do is read the log file and inside the logfile if i find the word which starts with PQR002106570.book then i need to replace the value of PQRXXX.book(this is unique) with its corresponding title. A list of id(PQRXXX.book) and its title are... (5 Replies)
Discussion started by: umapearl
5 Replies

8. UNIX for Dummies Questions & Answers

print previous month (current month minus 1) with Solaris date and ksh

Hi folks month=`date +%m`gives current month Howto print previous month (current month minus 1) with Solaris date and ksh (7 Replies)
Discussion started by: slashdotweenie
7 Replies

9. UNIX for Dummies Questions & Answers

Logfile manipulation

Hi First of all I m a complete newbie to Linux ... just started working on it exactly a week ago. I know a bit of programming in C but not very good in it.:D I was given task in my workplace and need some help nAJLR02F030879 9805 Thu Nov 19 13:27 <customerservice@YYY.com> ... (2 Replies)
Discussion started by: abilash.amara
2 Replies

10. Shell Programming and Scripting

logfile

hi iam new of the ksh script.iwant in formation of how to call in logfile in ksh scripts. if the meaning in ksh. please help me thanks naveen.g (1 Reply)
Discussion started by: naveeng.81
1 Replies
Login or Register to Ask a Question