Sponsored Content
Top Forums Shell Programming and Scripting [ksh] finding last file with keyword in it Post 302756163 by RudiC on Tuesday 15th of January 2013 10:08:13 AM
Old 01-15-2013
Not sure I understand your request.
So - the end time will be in the last file (key word END), and the begin (keyword BEGIN) will be in the same file or in four predecessors. Why not loop up to five times through ls -t LOG_hostx* (watch out, no -r option!), grepping each file for "BEGIN"? If there's more than one BEGIN and you need the last one, try tacing the files.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to search a keyword within a file using a for loop

hi guys i have a problem here, im trying to stablish a relationship between a text file and an input user for example the script is going to prompt the user for some football team and what the script is going to do is return the colums in which that input is located so far this is what i have ... (6 Replies)
Discussion started by: lucho_1
6 Replies

2. Shell Programming and Scripting

Ksh - finding pattern in file and generating a new file

I am trying to find for the pattern in first 5 bytes of every line in a text file and then generate a new file with the pattern found. Example: expected pattern is '-' to be serached in first 5 bytes of file only. Input File ab-cd jan-09 ddddd jan09 cc-ww jan09 dsgdq jan-09 ... (2 Replies)
Discussion started by: net
2 Replies

3. Shell Programming and Scripting

complex if statement syntax without using 'if ..' keyword in ksh.

It saves me lot of typing and space/lines when I do not use full 'if' keyword and construct, instead use .. && <statement> || <statement> that perfectly replaces.. if ; then <statement> else <statement> fi Can I use following syntax when I want to add multiple statements under 'if'... (4 Replies)
Discussion started by: kchinnam
4 Replies

4. Solaris

Keyword search input from a file

Hi, I have a file which got only one column and got some keywords. I have another file where the keywords used in the first file are repeated in the second file. Now I would like to know how many times each keyword from the first file is repeated in the second file. Request your help on... (1 Reply)
Discussion started by: pointers
1 Replies

5. Shell Programming and Scripting

Reading file contents until a keyword

Hi Guys, I need to read a file until I find a blank line. and in the next iteration I want to continue reading from the line I find a keyword. For ex: my file looks like PDS_JOB_ALIAS CRITERIA_ITEM_TYPE PDS_JOB_CRITERIA_ITEM CRITERIA_ITEM_TYPE First I want to read the file... (2 Replies)
Discussion started by: infintenumbers
2 Replies

6. Shell Programming and Scripting

Finding file pattern in ksh 88

Hi, I've to find the file which has the pattern "Delete Report for History Tables" and need to search this file pattern from directory which has sub directories as well. I'm using ksh 88 Please suggest me which command will be used to find the file pattern . Thanks. (1 Reply)
Discussion started by: smile689
1 Replies

7. Shell Programming and Scripting

Search for a Keyword in file and replace another keyword or add at the end of line

Hi I want to implement something like this: if( keyword1 exists) then check if(keyword2 exists in the same line) then replace keyword 2 with New_Keyword else Add New_Keyword at the end of line end if eg: Check for Keyword JUNGLE and add/replace... (7 Replies)
Discussion started by: dashing201
7 Replies

8. Shell Programming and Scripting

Need to extract the word after a particular keyword throughout the file..

Hi Everyone, Need help in extracting the hostname from the below output. Expected output: DS-TESTB-GDS-1.TEST.ABC.COM DS-TESTB-GDS-2.TEST.ABC.COM .... ... /tmp $ cat -n /tmp/patchreport 1 /usr/bin/perl /admin/bin/patch/applyPatches.pl --apply_patches... (4 Replies)
Discussion started by: thiyagoo
4 Replies

9. Shell Programming and Scripting

Bash to print if keyword not in file

I am trying to create an output file new that contains only the S5-00580 lines from list that are not in analysis_log. My attempt to do this is below. The new file would be used in the aria2c command to download only new folders. The aria2c command works to download all the files in list, but... (7 Replies)
Discussion started by: cmccabe
7 Replies

10. UNIX for Beginners Questions & Answers

How to align/sort the column pairs of an csv file, based on keyword word specified in another file?

I have a csv file as shown below, xop_thy 80 avr_njk 50 str_nyu 60 avr_irt 70 str_nhj 60 avr_ngt 50 str_tgt 80 xop_nmg 50 xop_nth 40 cyv_gty 40 cop_thl 40 vir_tyk 80 vir_plo 20 vir_thk 40 ijk_yuc 70 cop_thy 70 ijk_yuc 80 irt_hgt 80 I need to align/sort the csv file based... (7 Replies)
Discussion started by: dineshkumarsrk
7 Replies
Test::use::ok(3)					User Contributed Perl Documentation					  Test::use::ok(3)

NAME
Test::use::ok - Alternative to Test::More::use_ok SYNOPSIS
use ok 'Some::Module'; DESCRIPTION
According to the Test::More documentation, it is recommended to run "use_ok()" inside a "BEGIN" block, so functions are exported at compile-time and prototypes are properly honored. That is, instead of writing this: use_ok( 'Some::Module' ); use_ok( 'Other::Module' ); One should write this: BEGIN { use_ok( 'Some::Module' ); } BEGIN { use_ok( 'Other::Module' ); } However, people often either forget to add "BEGIN", or mistakenly group "use_ok" with other tests in a single "BEGIN" block, which can create subtle differences in execution order. With this module, simply change all "use_ok" in test scripts to "use ok", and they will be executed at "BEGIN" time. The explicit space after "use" makes it clear that this is a single compile-time action. SEE ALSO
Test::More CC0 1.0 Universal To the extent possible under law, XX has waived all copyright and related or neighboring rights to Test-use-ok. This work is published from Taiwan. <http://creativecommons.org/publicdomain/zero/1.0> POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 45: Non-ASCII character seen before =encoding in 'XX'. Assuming UTF-8 perl v5.18.2 2012-09-11 Test::use::ok(3)
All times are GMT -4. The time now is 06:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy