Catpuring the last entry of a repetetive sequence from a file!


 
Thread Tools Search this Thread
Operating Systems Solaris Catpuring the last entry of a repetetive sequence from a file!
# 1  
Old 11-14-2006
Catpuring the last entry of a repetetive sequence from a file!

Hi,

I have my scheduled backups running on a Solaris Box using Veritas at 06:00 hrs daily. Now these backups are to be executed using Autosys Scheduler in a job workflow and hence the scheduled backups needed to be converted to scripts which could be executed by the Autosys Scheduler. On account of certain bugs ,some option do not work when converting Veritas Scheduled backups to shell scripts. These limitations have forced us to continue with the scheduled backups from veritas .

In order that the dependent activities on the Scheduled Backup such as an EOD batch run are run only after succesful completion of the backup by measn of the Autosys Scheduler we need to create a script which checks and ensures that the current backup is completed successfully. This is done by checking a log file dumped by Veritas for the successful completion of the backup. This log file is created everyday at 08:00 hrs.

Problem would be in a scenario whereby I have refired the scheduled backup successfully again during the day say at around 09:00 hrs for some reason. If the backup scheduled at 06:00 hrs the next morning fails but the check backup script which checks for only success status of the backup executes at 06:15 hrs ,it will find the entry of the successful backup fired at 09:00hrs of the previous day on the file and treat it as a successful backup.

Question here would be how would the script be able to check for the latest entry of the backup and determine the status based on the last entry. Have tried but am not getting any solutions. Would be great if anyone had any suggestions to counter this problem.

Regds,
Jobby
# 2  
Old 11-14-2006
I did not understand that rambling text, but based on the title on this thread, maybe this is what you need...
Code:
$ cat file
one  something
two  something
three  something
last line
$ sed -n '/something/h;${;g;p;}'  < file
three  something
$

# 3  
Old 11-15-2006
Hi,

Guess had too much coffee while posting the issue and hence the rambling text. Same works fine. Can I have a breakup of the command if it's not too much trouble. Just wanted some clarity... Thanx any ways for the update and Will try to keep the cofee under control...

Regds,
Jobby
# 4  
Old 11-15-2006
if you can put the output into a file and then do tail -1 on the file you will get the last entry.
# 5  
Old 11-15-2006
MizzGail, the last line in the file may not have the pattern being sought. Look at my sample. You would display "last line" rather than "three something".

That sed command:
Code:
sed -n        means do not print automatically...require an explicit p command
/something/h  means if a line matches something move it hold area
;             just separates commands
$;{...;}      $ addresses last line  and the braces let me run several cmds instead of just one
g;p           get the hold area and then print

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to replace multiple "&nbsp;" entry with in <td> tag into single entry using sed?

I have the input file like this. Input file: 12.txt 1) There are one or more than one <tr> tags in same line. 2) Some tr tags may have one <td> or more tna one <td> tags within it. 3) Few <td> tags having "<td> &nbsp; </td>". Few having more than one "&nbsp;" entry in it. <tr> some td... (4 Replies)
Discussion started by: thomasraj87
4 Replies

2. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

3. Shell Programming and Scripting

Inserting IDs from a text file into a sequence alignment file

Hi, I have one file with one column and several hundred entries File1: NA1 NA2 NA3And now I need to run a command within a mapping aligner tool to insert these sample names into a sequence alignment file (SAM) such that they look like this @RG ID:Library1 SM:NA1 PL:Illumina ... (7 Replies)
Discussion started by: nans
7 Replies

4. Shell Programming and Scripting

Identifying Missing File Sequence

Hi, I have a file which contains few columns and the first column has the file names, and I would like to identify the missing file sequence number form the file and would copy to another file. My files has data in below format. APKRISPSIN320131231201319_0983,1,54,125,... (5 Replies)
Discussion started by: rramkrishnas
5 Replies

5. Shell Programming and Scripting

Get string of sequence from other file

Hi guys, Does anyone know how to get a string of sequence from other file? Should I use awk? Please see below. Thanks! LIST_FILE: >NAME1 >NAME3 >NAME5 >NAME7 >NAME8 SEQ_FILE: >NAME1 LEN75 100100101001010001010 >NAME2 LEN90 111010101010101101101 >NAME3 LEN27 101000101001010010101... (5 Replies)
Discussion started by: narachaid
5 Replies

6. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

7. UNIX for Dummies Questions & Answers

Help Parsing Sequence File

Hi Everyone, I am new in the world of UNIX and Shell scripting. I am working with a sequence file that looks like this: >contig00001 length=128 numreads=2 aTGTGCTGGgTGGGTGCCTGTTgCCccATGCTCCAGTtCAGGATTtCAGGCAttCTCATG TCCAGCATTTCTATTTAATCCTGCTGCTGGACTTGGGTGGtCTCAGTCtGGGAAGTGAGC tGTCTGTG... (8 Replies)
Discussion started by: Fahmida
8 Replies

8. Shell Programming and Scripting

Adding sequence to the file

How do I add the sequence number to the file? I have a file seperated by commas. appusage,243,jsdgh,798 appusage,876,0989,900 . . appusage,82374,ajfgdh,9284 The output would be as below 1,appusage,243,jsdgh,798 2,appusage,876,0989,900 . . 100,appusage,876,0989,900 (5 Replies)
Discussion started by: smee
5 Replies

9. Shell Programming and Scripting

Renaming a file use another file as a sequence calling a shl

have this shl that will FTP a file from the a directory in windows to UNIX, It get the name of the file stored in this variable $UpLoadFileName then put in the local directory LocalDir="${MPATH}/xxxxx/dat_files" that part seems to be working, but then I need to take that file and rename, I am using... (3 Replies)
Discussion started by: rechever
3 Replies

10. Shell Programming and Scripting

How to extract a sequence of n lines from a file

Hi I want to be able to extract a sequence of n lines from a file. ideas, commands and suggestions would be highly appreciated. Thanks (4 Replies)
Discussion started by: 0ktalmagik
4 Replies
Login or Register to Ask a Question