Sponsored Content
Top Forums Shell Programming and Scripting Substitute variable inside nawk Post 302903477 by mohtashims on Wednesday 28th of May 2014 12:20:10 AM
Old 05-28-2014
Quote:
Originally Posted by vgersh99
You have 2 variables called 'fname':
  1. Scalar fname passed into awk by: -v fname=$fname
  2. Array fname you're populating with $0: fname[$0]
What's the purpose of passing a scalar fname to awk?
What exactly are you after?
As i explained in the OP all i want is instead of using "prd" in the command i wish to use unix variable fname.

So, the problem is the below is not working !!
  1. Scalar fname passed into awk by: -v fname=$fname
Can you now help ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Substitute variable values

Hi, I am trying to redefine the value of a variable based on another variable value. And I want to read in my variables from a enviroment file in the end -- at least I think so. But 1st here's what I want I need to get working: var_1="11 10 9 8 7 6 5 4 3 2 1" var_2=3 var_3=4 So I want... (12 Replies)
Discussion started by: John Rihn
12 Replies

2. UNIX for Dummies Questions & Answers

Substitute Variable

Can anyone tell me what is the purpose of a substitute variable in the unix programming language and give an example where it may be used? Thanks! (0 Replies)
Discussion started by: mmg2711
0 Replies

3. Shell Programming and Scripting

case command inside awk/nawk

well I found lot of topics about awk..about if command in awk.. but I had to implement this: nawk -F"|" ' $47 ~ /0R0011/ { print > ("/home/user/M/MC.tmp" )} $47 ~ /0R0012/ { print > ("/home/user/M/DuSI.tmp" )} $47 ~ /0R0014/ { print > ("/home/user/M/FF.tmp" )} $47 ~ /0R0018/ { print >... (9 Replies)
Discussion started by: abdulaziz
9 Replies

4. Shell Programming and Scripting

using cp command inside nawk

Hello I have facing issue while using cp command inside nawk block. #!/bin/ksh my_name=$1 nawk -v my_name1=$my_name 'BEGIN { n = split(my_name1,names,":"); for (i=1;i<=n;i++) { print names; cpcmd = "cp " /tmp/test.txt" " ./sample system(cpcmd) } exit }' exit 0 i'am getting... (1 Reply)
Discussion started by: piscean_n
1 Replies

5. Shell Programming and Scripting

variable inside variable inside loop headache

Hi Gurus I have a file called /tmp/CMDB which looks like this serial: 0623AN1208 hostname: server1 model: x4100 assetID: 1234 I am writing a for loop that will go through this file line by line creating a variable of itself. Using the first iteration of the loop (i.e. the first line) as... (6 Replies)
Discussion started by: hcclnoodles
6 Replies

6. Shell Programming and Scripting

substitute variable for values in perl

hi all, how do i assign values passed in from command line to and sql statement in perl ?? e.g i want to assign :name1 and :Name2 to be whatever is passed into the perl script command line my $sqlStr = "select * from test_table where column1 = upper(nvl(:name1, name1 )) and column2... (1 Reply)
Discussion started by: cesarNZ
1 Replies

7. Shell Programming and Scripting

substitute variable in bash

hi all, Assume that i a having the following three lines in an executable file #/bin/bash a=Tue Tue=1 When i give echo $a the value should be 1, how to do this. Your suggestions please. Thanks in advance, Anish (4 Replies)
Discussion started by: anishkumarv
4 Replies

8. Shell Programming and Scripting

Reading input record from inside nawk

Hi friends, I have small query with reg to awk search pattern.. below is my sample file and code which i tried.. $ cat file.txt xxx,yyyyy,messageID,sha xxxx,errorcode,messageID,name in the above sample file - let assume I know the errorcode(2nd record) using which I want to... (2 Replies)
Discussion started by: Shahul
2 Replies

9. Shell Programming and Scripting

AWK variable substitute issue

dear, I have below file called folderlist.txt # ParentFolder environment_flag SubFolders triss 1 checksum bookstructure 1 fx 1 checksum_GMDB I have a script which which will create the folders under... (3 Replies)
Discussion started by: manas_ranjan
3 Replies

10. UNIX for Beginners Questions & Answers

How to avoid arguments inside Nawk command?

Hi, Here is my command print $2 was meant to select the second column however, it is getting substituted with the second argument that was passed to the script. Can you please tell me how can I resolve this ? (6 Replies)
Discussion started by: mohtashims
6 Replies
savemixer(8)						OSS System Administration Commands					      savemixer(8)

NAME
savemixer - Open Sound System program for saving and restoring mixer settings. SYNOPSIS
savemixer [-LVv] [-f <fname>] DESCRIPTION
The savemixer program saves mixer settings. It can also load saved mixer settings back into the mixer. Running this program without any parameters will save the current mixer settings into /var/lib/oss4/mixer.save or $OSSVARDIR/mixer.save file. OSSVARDIR is decided by reading /etc/oss.conf, and defaults to /var/lib/oss4. AUTOMATIC SAVE
By default the soundoff command will automatically run savemixer to save the active mixer settings. See the manual page for soundoff(1) if you like to turn this feature off. OPTIONS
-f<fname> Use <fname> as setting file. -L Loads saved mixer and device map information from mixer.save. -V Version information. -v Verbose output. SEE ALSO
soundoff(1), soundon(1), ossdetect(1), ossdevlinks(1), ossmix(1), ossxmix(1) FILES
/etc/oss.conf /usr/sbin/savemixer /var/lib/oss4/mixer.save /var/lib/oss4/dspdevs.map /var/lib/oss4/applist.conf AUTHOR
4Front Technologies 16 December 2012 savemixer(8)
All times are GMT -4. The time now is 03:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy