Sponsored Content
Top Forums Shell Programming and Scripting How to correct this awk code without eval? Post 302874955 by Jotne on Monday 18th of November 2013 05:28:48 AM
Old 11-18-2013
This works.
ps | awk "{print $var}"

Single quote does not expand variable.
This User Gave Thanks to Jotne For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can any body correct the code

#!/bin/ksh LOG_DATE=`date +%Y%m` export LOG_DATE cd D:/Informatica/Informatica_share/SrcFiles/l # mv SITE_ACTIVITY${LOG_DATE}*.CSV D:/Informatica/Informatica_share/SrcFiles/SITE_ACTIVITY${LOG_DATE}*.CSV # mv SITE_ACTIVITY20050914114546.CSV... (6 Replies)
Discussion started by: vivekanandarpat
6 Replies

2. UNIX for Advanced & Expert Users

can any body correct the code

#!/bin/ksh LOG_DATE=`date +%Y%m` export LOG_DATE cd D:/Informatica/Informatica_share/SrcFiles/l # mv SITE_ACTIVITY${LOG_DATE}*.CSV D:/Informatica/Informatica_share/SrcFiles/SITE_ACTIVITY${LOG_DATE}*.CSV # mv SITE_ACTIVITY20050914114546.CSV... (2 Replies)
Discussion started by: vivekanandarpat
2 Replies

3. Shell Programming and Scripting

Please correct the code

Hi, Some part of output: ================ $ hwmgr show scsi SCSI DEVICE DEVICE DRIVER NUM DEVICE FIRST HWID: DEVICEID HOSTNAME TYPE SUBTYPE OWNER PATH FILE VALID PATH ------------------------------------------------------------------------- 68: ... (10 Replies)
Discussion started by: mansa
10 Replies

4. Shell Programming and Scripting

Awk error -- awk: 0602-562 Field $() is not correct.

typeset -i i=1 while read -r filename; do Splitfile=`$Targetfile_$i.txt` awk 'substr($0,1,5) == substr($filename,1,5) && substr($0,526,2) == substr($filename,6,2) && substr($0,750,12) == substr($filename,8,12)' $SourceFilename >> $Splitfile i=i+1 done < /tmp/list.out I am using this logic... (1 Reply)
Discussion started by: pukars4u
1 Replies

5. Linux

Please correct me with my code?

Dear All On my Linux server, I need to separate the individual logs coming from various modules concurrently. Please find below a sample of the logs: But when I run it, I am receiving the following error: -bash: -f1.log : command not found -bash: $LOGFILE : ambiguous redirect Can you... (4 Replies)
Discussion started by: hadimotamedi
4 Replies

6. Shell Programming and Scripting

Strange result of eval, how does eval really work with ssh?

Hi all, some small script with eval turned me to crazy. my OS is linux Linux s10-1310 2.6.16.53-0.8.PTF.434477.3.TDC.0-smp #1 SMP Fri Aug 31 06:07:27 PDT 2007 x86_64 x86_64 x86_64 GNU/Linux below script works well #!/bin/bash eval ssh remotehost date eval ssh remotehost ls below... (1 Reply)
Discussion started by: summer_cherry
1 Replies

7. Shell Programming and Scripting

Error in eval eval command to print html tags

anyone has any info on why this is complaining??? vivek@vivek-c5e55ef2e ~/TAC $ zoneCounter=1 vivek@vivek-c5e55ef2e ~/TAC $ optUsage1=23% vivek@vivek-c5e55ef2e ~/TAC $ eval eval echo "<th>Zone $zoneCounter </th><th align=\"left\"> \$optUsage$zoneCounter </th>" -bash: syntax error... (1 Reply)
Discussion started by: vivek d r
1 Replies

8. Shell Programming and Scripting

Error in eval eval command to print html tags

anyone has any info on why this is complaining??? vivek@vivek-c5e55ef2e ~/TAC $ zoneCounter=1 vivek@vivek-c5e55ef2e ~/TAC $ optUsage1=23% vivek@vivek-c5e55ef2e ~/TAC $ eval eval echo "<th>Zone $zoneCounter </th><th align=\"left\"> \$optUsage$zoneCounter </th>" -bash: syntax error... (13 Replies)
Discussion started by: vivek d r
13 Replies

9. Shell Programming and Scripting

Eval in awk

Hi I am trying to remove duplicates on keys in a file and so far the below seems to work sort -t\| -k2,4 input.txt| awk -F'|' '{if (NR==1) print $0} {x=$2 $3 $4} NR>1 {if ($2 $3 $4 != y) {print $0}} {y=x}' and now I want to pass comma seperated column number list to the script and use... (3 Replies)
Discussion started by: zulfi123786
3 Replies

10. Shell Programming and Scripting

Eval and get awk output assigned to variable

I want to do 2 things in single line that is evaluating a command to get return code and store $2 of awk if the command exit code is 0. eval "ade desc ${filename}@@/<branch_name> | grep Version | awk '{print $2}' 2>&1 1>/dev/null" ret=$? echo "$ret $val" if then ... (3 Replies)
Discussion started by: ezee
3 Replies
KPSEWHICH(1)						      General Commands Manual						      KPSEWHICH(1)

NAME
kpsewhich - standalone path lookup and and expansion for kpathsea SYNOPSIS
kpsewhich [options] [filenames] DESCRIPTION
This manual page is not meant to be exhaustive. The complete documentation for this version of TeX can be found in the info file or manual Kpathsea: A library for path searching. kpsewhich is used as a standalone front-end of the kpathsea library that can be used to examine variables and find files. When the -format option is not given, the search path used when looking for a file is inferred from the name given, by looking for a known extension. If no known extension is found, the search path for TeX source files is used. OPTIONS
kpsewhich accepts the following options: -debug num Set debugging flags. -D num Use a base resolution of num; the default, set by the installer, is typically 600. -dpi num As -D. -engine string Set $engine in the environment, which is used in some search paths. -expand-braces string Print variable and brace expansion of string. -expand-path string Print complete path expansion of string. -expand-var string Print variable expansion of string. -format name Use file type name. See the info manual for a list of valid names, or use the -help option to print the list. -help Print help message and exit. -interactive Ask for additional filenames to look up. -mktex fmt enable mktexfmt generation. (fmt=pk/mf/tex/tfm) -mode string Set device name for $MAKETEX_MODE to string; no default. -must-exist Search the disk as well as ls-R if necessary. -no-mktex fmt disable mktexfmt generation. (fmt=pk/mf/tex/tfm) -path string Search in the path string. -progname string Set program name to string. -show-path name Output search path for file type name. See the info manual for a list of valid names, or use the -help option to print the list. -var-value variable Print the expansion of variable. -version Print version information and exit. SEE ALSO
mktexlsr(1), mktexmf(1), mktexpk(1), mktextfm(1). Kpathsea 6.1.0 1 March 2011 KPSEWHICH(1)
All times are GMT -4. The time now is 01:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy