You mean loop through the fields and each lookup in the array, like this?
Also, do you want to search <Co> in all the records? Or only in the records that matched with $1? then it should be
or (again) loop through the fields and compare each field:
This User Gave Thanks to MadeInGermany For This Post:
First off, I have been learning AWK by trial and error over the last week or so, and there are some gaps in my basic understanding of the language.
Here is my situation: I am coding and outputting results from an experiment I conducted in Psyscope, which has all been compiled into a master file.... (2 Replies)
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)
Hi All,
I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations:
1. I am restrained to 2 input files only.
2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi everyone,
I've been thinking and trying/changing all day long the below code, maybe some awk expert could help me to fix the for loop I've thought,
I think I'm very close to the correct output.
file1 is:
<boxes content="Grapes and Apples">
<box No.="Box MT. 53">
<quantity... (8 Replies)
Hello everyone
Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried
sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
logs:
"/home/abc/public_html/index.php"
"/home/abc/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
how to use "cut" or "awk" or "sed" to get the following result:
abc
abc
xyz
xyz
xyz (8 Replies)
Hi,
I'm using Linux and bash shell. I have a file (F1.txt) with contents like
Table1 Column1 123abc
Table1 Column2 xyz
Table2 Column1 543
Now, I would like to get the output as
UPDATE Table1 SET Column1='123abc';
UPDATE Table1 SET Column2='xyz';
UPDATE Table2 SET Column1='543';... (3 Replies)
Hi Team. I am trying to execute a simple for loop within an awk but its giving a different result. Below is the main code:
awk '{for(i=1;i<=6;i++) print $i}'The result should be 1 2 3 4 5 6 but its not giving this result. Can someone please help? (3 Replies)
Discussion started by: chatwithsaurav
3 Replies
LEARN ABOUT DEBIAN
io::async::file
IO::Async::File(3pm) User Contributed Perl Documentation IO::Async::File(3pm)NAME
"IO::Async::File" - watch a file for changes
SYNOPSIS
use IO::Async::File;
use IO::Async::Loop;
my $loop = IO::Async::Loop->new;
my $file = IO::Async::File->new(
filename => "config.ini",
on_mtime_changed => sub {
my ( $self ) = @_;
print STDERR "Config file has changed
";
reload_config( $self->handle );
}
);
$loop->add( $file );
$loop->run;
DESCRIPTION
This subclass of IO::Async::Notifier watches an open filehandle or named filesystem entity for changes in its "stat()" fields. It invokes
various events when the values of these fields change. It is most often used to watch a file for size changes; for this task see also
IO::Async::FileStream.
While called "File", it is not required that the watched filehandle be a regular file. It is possible to watch anything that stat(2) may be
called on, such as directories or other filesystem entities.
EVENTS
The following events are invoked, either using subclass methods or CODE references in parameters.
on_dev_changed $new_dev, $old_dev
on_ino_changed $new_ino, $old_ino
...
on_ctime_changed $new_ctime, $old_ctime
Invoked when each of the individual "stat()" fields have changed. All the "stat()" fields are supported apart from "blocks" and "blksize".
Each is passed the new and old values of the field.
on_devino_changed $new_stat, $old_stat
Invoked when either of the "dev" or "ino" fields have changed. It is passed two File::stat instances containing the complete old and new
"stat()" fields. This can be used to observe when a named file is renamed; it will not be observed to happen on opened filehandles.
on_stat_changed $new_stat, $old_stat
Invoked when any of the "stat()" fields have changed. It is passed two File::stat instances containing the old and new "stat()" fields.
PARAMETERS
The following named parameters may be passed to "new" or "configure".
handle => IO
The opened filehandle to watch for "stat()" changes if "filename" is not supplied.
filename => STRING
Optional. If supplied, watches the named file rather than the filehandle given in "handle". The file will be opened for reading and
then watched for renames. If the file is renamed, the new filename is opened and tracked similarly after closing the previous file.
interval => NUM
Optional. The interval in seconds to poll the filehandle using stat(2) looking for size changes. A default of 2 seconds will be
applied if not defined.
METHODS
$handle = $file->handle
Returns the filehandle currently associated with the instance; either the one passed to the "handle" parameter, or opened from the
"filename" parameter.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-10-24 IO::Async::File(3pm)