11-12-2009
Scutinizer! You da man!
OK I see it now. I had a version that was close but instead of "print f" I just did a print.
I love awk but only brush up against it when I need it and learn as I go. Your comment on how to view the sub function return value was exactly the point I was missing.
Thanks I am a happy camper with my new, working one-line solution!
(Are you familiar with Frank Zappa's "Central Scrutinizer" from "Joe's Garage I, II, and III"? Just wondering.)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
awk -vwgt=$vWeight -vfac=$vFactor '
BEGIN {
printf("wgt:" wgt "\n");
printf("factor:" fac "\n");
total = sprintf("%.0f", wgt * fac);
total2 = sprintf("%.0f", int(wgt * fac));
printf("total:" total "\n");
printf("total2:" total2 "\n");
}
'
if
vWeight=326.4
vFactor=100
the result... (2 Replies)
Discussion started by: qa.bingo
2 Replies
2. Shell Programming and Scripting
#!/bin/bash
awk '
function ad(t,r){
return (t+r);
}
BEGIN{
print ad(5,3);
}
{
print ad(5,3);
}
'
Doesn't print anything for the last print ad(5,3); (6 Replies)
Discussion started by: cola
6 Replies
3. Shell Programming and Scripting
Actually I got a list of file end with *.txt
I want to use the same command apply to all the *.txt
Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics.
For example:
I got the file below:
file1.txt
file2.txt
file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies
4. Shell Programming and Scripting
Hi, I have a file like this
SPF_HC00001|iCalcular_Monto_Minimo|--->|SPF_HC00028|pstcObtener_Monto_Minimo
SPF_HC00004|iCalcular_Incrementos|--->|SPF_HC00032|pstcObtener_Num_Incrementos
SPF_HC00005|iCalcular_Articulo_167_Reformado|--->|SPF_HC00031|pstcObtener_Por_CB_Inc... (2 Replies)
Discussion started by: kcoder24
2 Replies
5. Shell Programming and Scripting
I created two functions that output two random variables. I want to output them in the output file. But it does not seem to work.
# Function rgaussian1(r1, r2)
# Gaussian random number generator
function rgaussian1(r1, r2) {
pi = 3.142
v1 = sqrt( -2 * log(rand()) )
v2... (18 Replies)
Discussion started by: kristinu
18 Replies
6. Solaris
Hello folks,
I have a newly installed Solaris 10 system running on a T6320 blade. I have set up LDM with the intent to move an ldom from another blade to this one. So far, so good.
I had the SAN folks make the LUNs belonging to the ldom visible to my new blade and I can see them, all 4 paths.... (4 Replies)
Discussion started by: Ranck
4 Replies
7. UNIX for Dummies Questions & Answers
Hi!
I have a new problem with awk, this time I think is because I'm using it in bash and I don't know how to put the valor of the variable in awk. Here is the code:
#!/bin/bash
for i in 1 2 3 4 5
do
a=$i
b=$
awk '$1>=a&&$1<=b {print $1,$2,$3}'>asdf test... (3 Replies)
Discussion started by: florpi
3 Replies
8. Shell Programming and Scripting
I am trying to figure out why I am having a "problem" with some functions in a bash script I am running. The reason for air quoting is that the functions are working, they are just not displaying anything to screen when called from another function. Here's an example:
function Create_Input
{... (6 Replies)
Discussion started by: dagamier
6 Replies
9. Shell Programming and Scripting
Hello guys :)
I've a some issue with a function which use the bash colors in my script.
An example :
#!/bin/bash
set -x
log_in(){
host="srv1"
remote_files="log/"
LOG_FILE="logfile"
green='\033]; then
color_in_red=("${red}"$2"${none}")
echo -e... (2 Replies)
Discussion started by: Arnaudh78
2 Replies
10. Shell Programming and Scripting
Hello,
I have this awk code in a bash script to perform a find and replace task. This finds one unique line in a file and substitutes the found line with a replacement.
#! /bin/bash
# value determined elsewhere
total_outputs_p1=100
# file being modified... (5 Replies)
Discussion started by: LMHmedchem
5 Replies
LEARN ABOUT REDHAT
lp-cups
lp(1) Easy Software Products lp(1)
NAME
lp - print files
cancel - cancel jobs
SYNOPSIS
lp [ -E ] [ -c ] [ -d destination ] [ -h server ] [ -m ] [ -n num-copies [ -o option ] [ -q priority ] [ -s ] [ -t title ] [ -H handling ]
[ -P page-list ] [ file(s) ]
lp [ -E ] [ -c ] [ -h server ] [ -i job-id ] [ -n num-copies [ -o option ] [ -q priority ] [ -t title ] [ -H handling ] [ -P page-list ]
cancel [ -a ] [ -h server ] [ id ] [ destination ] [ destination-id ]
DESCRIPTION
lp submits files for printing or alters a pending job.
cancel cancels existing print jobs. The -a option will remove all jobs from the specified destination.
OPTIONS
The following options are recognized by lp:
-E
Forces encryption when connecting to the server.
-c
This option is provided for backwards-compatibility only. On systems that support it, this option forces the print file to be copied
to the spool directory before printing. In CUPS, print files are always sent to the scheduler via IPP which has the same effect.
-d destination
Prints files to the named printer.
-h hostname
Specifies the print server hostname. The default is "localhost" or the value of the CUPS_SERVER environment variable.
-i job-id
Specifies an existing job to modify.
-m
Send email when the job is completed (not supported CUPS 1.1.)
-n copies
Sets the number of copies to print from 1 to 100.
-o option
Sets a job option.
-q priority
Sets the job priority from 1 (lowest) to 100 (highest). The default priority is 50.
-s
Do not report the resulting job IDs (silent mode.)
-t name
Sets the job name.
-H handling
Specifies when the job should be printed. A value of immediate will print the file immediately, a value of hold will hold the job
indefinitely, and a time value (HH:MM) will hold the job until the specified time. Use a value of resume with the -i option to resume
a held job.
-P page-list
Specifies which pages to print in the document. The list can contain a list of numbers and ranges (#-#) separated by commas (e.g.
1,3-5,16).
COMPATIBILITY
Unlike the System V printing system, CUPS allows printer names to contain any printable character except SPACE and TAB. Also, printer and
class names are not case-sensitive.
The "m" option is not functional in CUPS 1.1.
The "q" option accepts a different range of values than the Solaris lp command, matching the IPP job priority values (1-100) instead of the
Solaris values (0-39).
SEE ALSO
lpstat(1), CUPS Software Users Manual, http://localhost:631/documentation.html
COPYRIGHT
Copyright 1993-2002 by Easy Software Products, All Rights Reserved.
25 September 2001 Common UNIX Printing System lp(1)