Sponsored Content
Full Discussion: variable passed to awk
Top Forums UNIX for Dummies Questions & Answers variable passed to awk Post 55566 by google on Tuesday 14th of September 2004 08:41:26 PM
Old 09-14-2004
Use the -v switch to pass in a variable to Awk. Go to ]GNU and search for gAwk documentation for more details.

Code:
awk -v job=$job BEGIN '{FS= "|"; print "$job\n","Question \n"} {print $1,$2,$4," ",$3}'  file1


Last edited by google; 09-14-2004 at 10:07 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

variable passed to awk

Anybody know what's wrong with this syntax? awk -v job="$job" 'BEGIN { FS="|"} {print $1,$2," ",$4," ",$3\n,$5,"\n"}' list It's keeping give me this message: awk: syntax error near line 1 awk: bailing out near line 1 It seems awk has problem with my BEGIN command. Any... (8 Replies)
Discussion started by: whatisthis
8 Replies

2. UNIX for Dummies Questions & Answers

Assigning a Variable all the Parameters passed

Hi, I have a unix script which can accept n number of parameters . I can get the parameter count using the following command and assign it to a variable file_count=$# Is there a similar command through which i can assign a variable all the values that i have passed as a parameter ... (2 Replies)
Discussion started by: samit_9999
2 Replies

3. Shell Programming and Scripting

My variable cannot be passed through into my path

Hi, Can you please help. I am scripting in sh and I am trying to simply copy one directory to another but for some reason my variables are not recognised? echo "The latest version of the program is being found......." cd $SOFTWARE/src/$progname version=`ls $SOFTWARE/src/$progname | grep... (13 Replies)
Discussion started by: cyberfrog
13 Replies

4. Shell Programming and Scripting

arithmetic from csh variable passed to awk

I have the following code in a csh script I want to pass the value of the variable sigmasq to the awk script so that I can divide $0 by the value of sigmasq grep "Rms Value" $f.log \ | awk '{ sub(/*:*\.*/,x); \ print... (2 Replies)
Discussion started by: kristinu
2 Replies

5. Shell Programming and Scripting

Why Perl Subroutine Passed In Variable is 1?

The following subroutine prints 1 instead of the content of the Equipment variable. Can someone tell me why? #!c:/perl/bin/perl.exe # use strict 'vars'; my $Equipments = "data/equips.txt"; unless (open(EQUIP_FH, "$Equipments")) { print "errors: $Equipments\n"; # This line prints... (1 Reply)
Discussion started by: tqlam
1 Replies

6. UNIX for Advanced & Expert Users

Value of variable not getting passed in child script

Hi, I am facing a challenge in fixing an issue in my installation scripts.Here is a situation: There are 3 files which are invoked at a below given order: Installer.ksh----->Installer.xml(Ant script)------->common.ksh I am outputting a message from common.ksh at a terminal, after that trying to... (3 Replies)
Discussion started by: baig_1988
3 Replies

7. Shell Programming and Scripting

In the sh file variable is not being passed on.

I am having difficulties with the fllowing script: !/bin/sh voicemaildir=/var/spool/asterisk/voicemail/$1/$2/INBOX/ echo `date` ':' $voicemaildir >> /var/log/voicemail-notify.log for audiofile in `ls $voicemaildir/*.wav`; do transcriptfile=${audiofile/wav/transcript} ... (4 Replies)
Discussion started by: ghurty
4 Replies

8. Shell Programming and Scripting

Variable passed as argument

I have a script. #!/bin/sh cur_$1_modify_time=Hello echo "cur_$1_modify_time" When I run like sh /root/script1 jj I expect value "Hello" being assigned to variable "cur_jj_modify_time" and output being "Hello" ie echoing $cur_jj_modify_time But the output comes as # sh... (3 Replies)
Discussion started by: anil510
3 Replies

9. Shell Programming and Scripting

Variable not passed to the sed command

Hello, I am writing a script which is not giving the desired result. When I check the content of the 'InputFile_009_0.sh', it shows following with missing Index in this command sed -i "s/L1ITMBLT.root/L1ITMBLT_"".root/g" run_DttfFromCombinedPrimitives_cfg.py of . Any help? ... (13 Replies)
Discussion started by: emily
13 Replies

10. Shell Programming and Scripting

Bash variable not being passed

In the bash below the variable date displays in the echo. However when I use it in the for loop it does not. Basically, the user inputs a date then that date is converted to the desired format of (month-day-year, no leading 0). That input is used in the for loop to return every file that matches... (5 Replies)
Discussion started by: cmccabe
5 Replies
PSERVER(1)							      pserver								PSERVER(1)

NAME
pserver - NetWare print server SYNOPSIS
pserver [ -S server ] [ -h ] [ -U user name ] [ -P password | -n ] [ -C ] [ -q queue name ] [ -c command ] [ -j job type ] [ -t timeout ] [ -d ] DESCRIPTION
pserver is a program that connects to print queues on NetWare servers and feeds incoming print jobs to the Linux printing system. OPTIONS
-h -h is used to print out a short help text. -S server server is the name of the server you want to use. -U user user is the print server name at the server. -P password password is the password to use for the print server at the server. If neither -n nor -P are given, and the user has no open connection to the server, pserver prompts for a password. -n -n should be given if the print server does not require a password. -C By default, passwords are converted to uppercase before they are sent to the server, because most servers require this. You can turn off this conversion by -C. -q queue name queue name is the name of the print queue you want to service. -c command When a job is received from the print queue, pserver forks off a new process, and feeds the job file to stdin. command is the printing command that is executed for each job. The default command is 'lpr'. You can insert several flags into the command, preceded by %. These are replaced with values retrieved from the queue structure for the print job. %u: This field will be replaced by the name of the user who posted this print job. %d: This field will be replaced by the job description field of this print job. -j job type Each job in a NetWare print queue has a job type. For print jobs, this corresponds to the number of the form the job should be printed on. You can tell pserver that it should only receive jobs for one specific form from the queue. The default is -1, which means that everything is received. -t timeout Pserver is not informed by NetWare servers when new jobs arrive. So a polling scheme has to be used. When there are no jobs to service, timeout tells pserver how long to wait between two requests. The default is 30 seconds. When a job is finished, pserver asks the NetWare server immediately for a new job, and does not wait timeout seconds. -d Normally, pserver daemonizes itself. -d tells it not to do so. This is useful if you want to see the diagnostic messages that are printed when a error occurs. SEE ALSO
nwclient(5), slist(1), pqlist(1), ncpmount(8), ncpumount(8) CREDITS
pserver was written by Volker Lendecke (lendecke@math.uni-goettingen.de) pserver 10/22/1996 PSERVER(1)
All times are GMT -4. The time now is 04:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy