Sponsored Content
Top Forums Shell Programming and Scripting How to end tail -f from the script? Post 302910972 by Corona688 on Tuesday 29th of July 2014 11:02:23 AM
Old 07-29-2014
It separates two independent statements.

The first /item/, by itself, means 'print lines matching "item"'. It defaults to print when no other statement is given. The second one, which has a code block after, means 'quit when a line matches "item"'.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep or Tail in shell script

Hi, I am writing a shell script that checks catalina logs on a production system and mails me if it detects errors. It greps the logs for known errors which i have defined as variables. The problem is the logs are huge, approx 30,000 before they rotate. So I am forced to use grep instead... (3 Replies)
Discussion started by: Moxy
3 Replies

2. Shell Programming and Scripting

How to tail log in one script?

I have three prodcution box Prod1 Prod2 Prod3 I want to write a script which tail the log for each production box and put it into some file which I have want to tail For example Prod1 ----- TIMER IXN=MEMPUT, USR=GGu1, elapsed = 0.176 seconds. 11:41:44 AUDIT MEMPUT: member... (4 Replies)
Discussion started by: mr_harish80
4 Replies

3. Shell Programming and Scripting

tail script gone wrong

Hi guys... What am I doing wrong? #!/bin/sh LINES=1 FILE=test.log TAIL="/usr/bin/tail -n" $TAIL -${LINES} ${FILE} Error: ./tail.sh usage: tail ] tail ] ---------- Post updated at 08:41 AM ---------- Previous update was at 08:32 AM ---------- please ignore this... (3 Replies)
Discussion started by: jazzaddict
3 Replies

4. Shell Programming and Scripting

using tail -f and tr in a script

I have file that is being constantly written to example: file.txt ABC EBC ZZZ ABC I am trying to create a simple script that will tail this file and at the same time using tr to change B to F on lines containing 'B'. I tried this and it doesn't seem to work. #!/bin/bash tail -f... (8 Replies)
Discussion started by: zerofire123
8 Replies

5. Shell Programming and Scripting

Doing a tail in a script and then return back and continue script

Hello all, I am trying to do a tail in a script. But when I quit the tail my script quits also. This is not what I want. I am struggling to get this done. #!/bin/bash askFile() { echo -n "Enter file: " read FILE } doTail() { tail -F "${1}" } askFile doTail... (4 Replies)
Discussion started by: markdark
4 Replies

6. Shell Programming and Scripting

Use of Begin IF ,END IF END not working in the sql script

Hi I have written a script .The script runs properly if i write sql queries .But if i use PLSQL commands of BEGIN if end if , end ,then on running the script the comamds are getting printed on the prompt . Ex :temp.sql After connecting to the databse at the sql prompt i type... (1 Reply)
Discussion started by: isha_1
1 Replies

7. Shell Programming and Scripting

bash script to display tail

Hi everyone, I'm trying to write a script to format a file using unix2dos. I want to output all but the first 14 lines in a file. Then I want to pipe this to unix2dos to convert the output to a file that's easily readable on windows. Here's what I have: export Lines=`wc -l < $1` export... (11 Replies)
Discussion started by: LuminalZero
11 Replies

8. Shell Programming and Scripting

script to kill tail processes

my unix machine is currently shared by many teams, because of that lots of processess are running and bad part is taht when I do psu ...i can see all tail processes as well , meaning ppl who have viewed files with tail and have forgotten to close it. command prompt >> psu tail -n 0 -f... (2 Replies)
Discussion started by: mitsyjohn
2 Replies

9. Shell Programming and Scripting

Help On tail script

Hi Guys, I would like to create a script which tails the content of a log file in real time, looks for a specific string , like "ERROR" and captures in a text file the previous 10.000 lines that were existing before this string. Any help is appreciated. (12 Replies)
Discussion started by: liviusbr
12 Replies

10. Shell Programming and Scripting

Joining multiple files tail on tail

I have 250 files that have 16 columns each - all numbered as follows stat.1000, stat.1001, stat.1002, stat.1003....stat.1250. I would like to join all 250 of them together tail by tail as follows. For example stat.1000 a b c d e f stat.1001 g h i j k l So that my output... (2 Replies)
Discussion started by: kayak
2 Replies
Gedcom::Item(3pm)					User Contributed Perl Documentation					 Gedcom::Item(3pm)

NAME
Gedcom::Item - a base class for Gedcom::Grammar and Gedcom::Record Version 1.16 - 24th April 2009 SYNOPSIS
use Gedcom::Record; $item->{grammar} = Gedcom::Grammar->new(file => $item->{grammar_file}, callback => $item->{callback}); my $c = $item->copy; $item->read if $item->{file}; $item->add_items($rec); while (my $next = $item->next_item($item)) my $line = $item->next_line; my $line = $item->next_text_line; $item->write($fh, $level, $flush); $item->write_xml($fh, $level); $item->print; my $item = $item->get_item("CHIL", 2); my @items = $item->get_item("CHIL"); my $parent = $item->parent; my $success = $item->delete; $item->delete_item($sub_item); my $v = $item->level; $item->level(1); my $v = $item->xref; my $v = $item->tag; my $v = $item->value; my $v = $item->pointer; my $v = $item->min; my $v = $item->max; my $v = $item->gedcom; my $v = $item->file; my $v = $item->line; my $v = $item->full_value; my $sub_items = $item->_items; my @sub_items = $item->items; $item->delete_items; DESCRIPTION
A selection of subroutines to handle items in a gedcom file. HASH MEMBERS
Some of the more important hash members are: $item->{level} The level of the item. $item->{xref} The cross reference, either hard or soft. $item->{tag} The name of the tag. $item->{value} The value of the item. $item->{pointer} True iff the value is a pointer to another item. $item->{min} The minimum number of items allowed. $item->{max} The maximum number of items allowed. $item->{gedcom} The top level gedcom object. $item->{file} The file from which this object was read, if any. $item->{line} The line number from which this object was read, if any. $item->{items} Array of all sub-items of this item. It should not be necessary to access these hash members directly. METHODS
new $item->{grammar} = Gedcom::Grammar->new(file => $item->{grammar_file}, callback => $item->{callback}); Create a new object. If file is supplied, it is the name of a file to read. If callback is supplied, it is a subroutine reference which is called at various times while the file is being read. The subroutine takes five parameters: $title: A title $txt1: One text message $txt2: A secondary text message $current: A count of how far through the file we are $total: The extent of the file The subroutine should return true iff the file shuld continue to be read. copy my $c = $item->copy; Make a copy of the object. The sub-items are copied too. read $item->read if $item->{file}; Read a file into the object. Called by the constructor. add_items $item->add_items($rec); Read in the sub-items of a item. next_item while (my $next = $item->next_item($item)) Read the next item from a file. Return the item or false if it cannot be read. next_line my $line = $item->next_line; Read the next line from the file, and return it or false. next_text_line my $line = $item->next_text_line; Read the next line of text from the file, and return it or false. write $item->write($fh, $level, $flush); Write the item to a FileHandle. The subroutine takes three parameters: $fh: The FileHandle to which to write $level: The level of the item $flush: Whether or not to indent the gedcom output according to the level write_xml $item->write_xml($fh, $level); Write the item to a FileHandle as XML. The subroutine takes two parameters: $fh: The FileHandle to which to write $level: The level of the item Note that this function is experimental. Please read the warnings for Gedcom::write_xml(). print $item->print; Print the item. Used for debugging. (What? There are bugs?) get_item my $item = $item->get_item("CHIL", 2); my @items = $item->get_items("CHIL"); Get specific sub-items from the item. The arguments are the name of the tag, and optionally the count. In scalar context, returns the sub-item, or undef if it doesn't exist. In array context, returns all sub-items matching the specified tag. get_child NOTE - This function is deprecated - use get_item instead my $child = get_child("CHIL2"); Get a specific child item from the item. The argument contains the name of the tag, and optionally the count. The regular expression to generate the tag and the count is: my ($tag, $count) = $t =~ /^_?(w+?)(d*)$/ Returns the child item, or undef if it doesn't exist get_children NOTE - This function is deprecated - use get_item instead my @children = get_children("CHIL"); parent my $parent = $item->parent; Returns the parent of the item or undef if there is none. Note that this is an expensive function. A child does not know who its parent is, and so this function searches through all items looking for one with the appropriate child. delete my $success = $item->delete; Deletes the item. Note that this is an expensive function. It use parent() described above. It is better to use $parent->delete_item($child), assuming that you know $parent. Note too that this function calls delete_item(), so its caveats apply. delete_item $item->delete_item($sub_item); Delete the specified sub-item from the item. Note that this function doesn't do any housekeeping. It is up to you to ensure that you don't leave any dangling pointers. Access functions my $v = $item->level; $item->level(1); my $v = $item->xref; my $v = $item->tag; my $v = $item->value; my $v = $item->pointer; my $v = $item->min; my $v = $item->max; my $v = $item->gedcom; my $v = $item->file; my $v = $item->line; Return the eponymous hash element. If a value if passed into the function, the element is first assigned that value. full_value my $v = $item->full_value; Return the value of the item including all CONT and CONC lines. This is probably what you want most of the time, and is the function called by default from other functions that return values. If, for some reason, you want to process CONT and CONC items yourself, you will need to use the value() function and probably the items() function. _items my $sub_items = $item->_items; Return a reference to alist of all the sub-items, reading them from the Gedcom file if they have not already been read. It should not be necessary to use this function. See items(). items my @sub_items = $item->items; Return a list of all the sub-items, reading them from the Gedcom file if they have not already been read. In general it should not be necessary to use this function. The sub-items will usually be accessed by name. This function is only necessary if the ordering of the different items is important. This is very rare, but is needed for example, when processing CONT and CONC items. delete_items $item->delete_items; Delete all the sub-items, allowing the memory to be reused. If the sub-items are required again, they will be reread. It should not be necessary to use this function unless you are using read_only mode and need to reclaim your memory. perl v5.14.2 2012-04-12 Gedcom::Item(3pm)
All times are GMT -4. The time now is 03:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy