Even though this discussion about awk intrinsics is fascinating and my horizon was expanded (a collective "thank you" to you all in this thread), just for the record:
Wouldn't the usage of shell means (variable expansion or field splitting) be less costly than the use of an external program? I suppose thread-o/p does something with the values once he split them, something along the lines of:
I put this here because it is a 'behavior' type question..
I seem to remember doing ls .* and getting all the .-files, like
.profile
.login
etc.
But ls .* doesn't do that, it lsts the contents of every .*-type subdirectory.
Is it supposed to?
I should think that a -R should be given to... (10 Replies)
Hi All,
I ve written a small program to get started off with pthreads. I somehow feel the program doesnt meet the purpose. Please find the code and the output below. Please find my question at the bottom.
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
void *PrintThread1(void... (4 Replies)
the sed command:
sed 's/^*//' file
does not work on HP-UX :-( but it works fine on Linux,
content of file:
<tab><tab>hello
output should be:
hello
Any ideas??
Thank you
Andy (8 Replies)
I have the following program:
int main(int argc, char** argv){
unsigned long int mean=0;
for(int i=1;i<10;i++){
mean+=poisson(12);
cout<<mean<<endl;
}
cout<<"Sum of poisson: "<< mean;
return 0;
}
when I run it, I get the... (4 Replies)
Our comp-operator has come across a peculiar ‘feature'. We have this directory where we save all the reports that were generated for a particular department for only one calendar year. Currently there are 45,869 files. When the operator tried to backup that drive it started to print a flie-listing... (3 Replies)
Hi Experts
I am facing a weird issue while using print statement in awk. I have a text file with 3 fields shown below:
# cat f1
234,abc,1000
235,efg,2000
236,jih,3000
#
When I print the third column alone, I dont face any issue as shown below:
# awk '{print $3 }' FS=, f1
1000
2000... (5 Replies)
Aix 6.1, working with a nim master and nim_altmaster
both LPARS have access to the same data LUN, /nimdisk
I do realize the risks of having 2 servers access the same LUN, however it serves the purpose of being able to restore mksysb's to/from our DR site if necessary, at least in theory ;)
... (3 Replies)
Hi there,
I am a bit puzzled by a weird behavior of Vi. I very simply would like to add increased numbers in some files. Since I have many thousands entries per file and many files, I would like to macro it in vi.
To do this, I enter the first number ("0001") on the first line and then yank... (4 Replies)
Hello Admin,
Could you pls explain on the below behavior of the awk command.
$ awk -F">20" "/Cyclomatic complexity/ && /;add;/{print \$1}" inspect_64d_369980 | awk '{print $NF}' | sort | tail -1
65
$var=`awk -F">20" "/Cyclomatic complexity/ && /;add;/{print \$1}" inspect_64d_369980 | awk... (3 Replies)
Discussion started by: chandana hs
3 Replies
LEARN ABOUT DEBIAN
template::plugin::datafile
Template::Plugin::Datafile(3pm) User Contributed Perl Documentation Template::Plugin::Datafile(3pm)NAME
Template::Plugin::Datafile - Plugin to construct records from a simple data file
SYNOPSIS
[% USE mydata = datafile('/path/to/datafile') %]
[% USE mydata = datafile('/path/to/datafile', delim = '|') %]
[% FOREACH record = mydata %]
[% record.this %] [% record.that %]
[% END %]
DESCRIPTION
This plugin provides a simple facility to construct a list of hash references, each of which represents a data record of known structure,
from a data file.
[% USE datafile(filename) %]
A absolute filename must be specified (for this initial implementation at least - in a future version it might also use the
"INCLUDE_PATH"). An optional "delim" parameter may also be provided to specify an alternate delimiter character.
[% USE userlist = datafile('/path/to/file/users') %]
[% USE things = datafile('items', delim = '|') %]
The format of the file is intentionally simple. The first line defines the field names, delimited by colons with optional surrounding
whitespace. Subsequent lines then defines records containing data items, also delimited by colons. e.g.
id : name : email : tel
abw : Andy Wardley : abw@tt2.org : 555-1234
sam : Simon Matthews : sam@tt2.org : 555-9876
Each line is read, split into composite fields, and then used to initialise a hash array containing the field names as relevant keys. The
plugin returns a blessed list reference containing the hash references in the order as defined in the file.
[% FOREACH user = userlist %]
[% user.id %]: [% user.name %]
[% END %]
The first line of the file must contain the field definitions. After the first line, blank lines will be ignored, along with comment line
which start with a '"#"'.
BUGS
Should handle file names relative to "INCLUDE_PATH". Doesn't permit use of '":"' in a field. Some escaping mechanism is required.
AUTHOR
Andy Wardley <abw@wardley.org> <http://wardley.org/>
COPYRIGHT
Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Template::Plugin
perl v5.14.2 2011-12-20 Template::Plugin::Datafile(3pm)