05-29-2012
thanks.
yes it is strange in its current form, I had to tweak it as i was only feeding the header.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I found this command in this forum, but, couldnt understand much from it.
could any one help me understand that???
the commands are :
awk '{sub(/ ~/,""); printf $0 ($0~/\|$/?ORS:"")}' file1 > file2
awk '{sub(/~ */,x);printf $0(/\|$/?ORS:x)}'
awk '{sub(/~ */,x);sub(/\|$/, "|\n")}8'... (4 Replies)
Discussion started by: hitmansilentass
4 Replies
2. Shell Programming and Scripting
please explain this awk '{print \$NF}'
i have a command
grep -i adding /logs/eap | grep -iv equation | awk '{print \$NF}' | sort -u | sed 's/\.\$//' >> /temp/t
please explain the above awk and sed
as well how it works
and also what is \$NF (1 Reply)
Discussion started by: mail2sant
1 Replies
3. Shell Programming and Scripting
echo "23.54" | awk '
function round(A) {
return int( A + 0.5 )
}
{
printf("%d\n",round($1));
}'> > > > > >
awk: syntax error near line 2
awk: bailing out near line 2 (2 Replies)
Discussion started by: santosh1234
2 Replies
4. Shell Programming and Scripting
Hi frnds,
one my frnds has given resolution for my problem as below. it working great , but i couldnt understand somethings in the script.
Why ++ operator after the function calling. how these each block working. will each run for each input line sequencially or one block for all the lines... (9 Replies)
Discussion started by: Gopal_Engg
9 Replies
5. UNIX for Dummies Questions & Answers
awk '!_++'
Most importantly, I want to know what the underscore does "!_"
But ideally, please breakdown the whole thing. It is supposed to remove duplicate lines when found in a file. (1 Reply)
Discussion started by: glev2005
1 Replies
6. Shell Programming and Scripting
Hi Guys,
Please help me, I am new to programming and I don’t understand what some parts of this code are doing. I have comments on the parts I know, please help if my understanding of the code is not correct and also help with parts with questions.
awk '
{
gsub( ">",... (1 Reply)
Discussion started by: James_Owen
1 Replies
7. Shell Programming and Scripting
Dear all ,
Can any people explain this awk command?
What is the purpose of if (v++){b=$i;$i=""}?
awk -F, '{for (i=1;i<=NF;i++){if (v++){b=$i;$i=""}};print $0} END { print "dups are" ;for ( i in b) print i}' OFS="," input_file
This script is used to replace column duplicate value
... (1 Reply)
Discussion started by: eldonlck
1 Replies
8. Shell Programming and Scripting
I have 2 files
recevied
abc
def
ghi
totallist
abc 123 jasdhfaj
def 345 fjdgkfsfh
ghi 567 dfjdhdhfj
jkl 678 djkahfdjshdf
xyz 984 jdfdhfhdh
myOutputFile
jkl 678 djkahfdjshdf
xyz 984 jdfdhfhdh
I used this command for the output : awk 'FNR==NR {f1;next} !($1 in f1)' recevied... (2 Replies)
Discussion started by: nani1984
2 Replies
9. Shell Programming and Scripting
Referring to this:
#!/bin/awk -f
BEGIN{
for(i=0;i<=10;i++)
{
if (i <=1 )
{
x=0;
y=1;
print i;
}
else
{
z=x+y;
print z;
x=y;
y=z;
}
} (3 Replies)
Discussion started by: p1ne
3 Replies
10. UNIX for Beginners Questions & Answers
Example:
`abc.ksh | grep '^GLIS'| awk -F' ' '{print \$1}'`; (3 Replies)
Discussion started by: Tanu
3 Replies
LEARN ABOUT DEBIAN
pdl::dbg
Dbg(3pm) User Contributed Perl Documentation Dbg(3pm)
NAME
PDL::Dbg - functions to support debugging of PDL scripts
SYNOPSIS
use PDL;
use PDL::Dbg;
$c = $a->slice("5:10,2:30")->px->diagonal(3,4);
PDL->px;
DESCRIPTION
This packages implements a couple of functions that should come in handy when debugging your PDL scripts. They make a lot of sense while
you're doing rapid prototyping of new PDL code, let's say inside the perldl or pdl2 shell.
FUNCTIONS
px
Print info about a piddle (or all known piddles)
pdl> PDL->px
pdl> $b += $a->clump(2)->px('clumptest')->sumover
pdl> $a->px('%C (%A) Type: %T') # prints nothing unless $PDL::debug
pdl> $PDL::debug = 1
pdl> $a->px('%C (%A) Type: %T')
PDL(52433464) Type: Double
This function prints some information about piddles. It can be invoked as a class method (e.g. "PDL->px" ) or as an instance method (e.g.
"$pdl->px($arg)"). If
invoked as a class method
it prints info about all piddles found in the current package (excluding "my" variables). This comes in quite handy when you are not
quite sure which pdls you have already defined, what data they hold , etc. "px" is supposed to support inheritance and prints info about
all symbols for which an "isa($class)" is true. An optional string argument is interpreted as the package name for which to print
symbols:
pdl> PDL->px('PDL::Mypack')
The default package is that of the caller.
invoked as an instance method
it prints info about that particular piddle if $PDL::debug is true and returns the pdl object upon completion. It accepts an optional
string argument that is simply prepended to the default info if it doesn't contain a "%" character. If, however, the argument contains a
"%" then the string is passed to the "info" method to control the format of the printed information. This can be used to achieve
customized output from "px". See the documentation of "PDL::info" for further details.
The output of px will be determined by the default formatting string that is passed to the "info" method (unless you pass a string
containing "%" to px when invoking as an instance method, see above). This default string is stored in $PDL::Dbg::Infostr and the default
output format can be accordingly changed by setting this variable. If you do this you should also change the default title string that the
class method branch prints at the top of the listing to match your new format string. The default title is stored in the variable
$PDL::Dbg::Title.
For historical reasons "vars" is an alias for "px".
vars
Alias for "px"
BUGS
There are probably some. Please report if you find any. Bug reports should be sent to the PDL mailing list perldl@jachw.hawaii.edu.
AUTHOR
Copyright(C) 1997 Christian Soeller (c.soeller@auckland.ac.nz). All rights reserved. There is no warranty. You are allowed to redistribute
this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is
separated from the PDL distribution, the copyright notice should be included in the file.
perl v5.14.2 2012-01-02 Dbg(3pm)