Sponsored Content
Top Forums Shell Programming and Scripting Cannot resolve $variable in awk Post 302825505 by Mohana29_1988 on Monday 24th of June 2013 01:38:17 PM
Old 06-24-2013
Cannot resolve $variable in awk

My script
----------
Code:
for i in `cat n`;do
export k=`echo "CSN: "$i` //combining CSN: and value from n
echo "$k"
awk ''{print "CSN: "$0;}'{_=29}_&&_--' file1|tail -1 >> file2
done

In the above script i cannot able to resolve $k in awk command
file n contains
------------
Code:
0000
1111
2222
3333
4444
6666

I am trying to append CSN: 0000 and search it in the file1 and
display the 29th line from the searched pattern

Last edited by Don Cragun; 06-24-2013 at 05:17 PM.. Reason: Remove spinner...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Resolve a Variable

Hi I have a variable which is a path ie: UBERROR=/cobwrk/mchr/prodsup/ub/wrk/../error is there anyway I can get the output of an echo to read: #echo $UBERROR /cobwrk/mchr/prodsup/ub/error instead of #echo $UBERROR /cobwrk/mchr/prodsup/ub/wrk/../error Many thanks! (2 Replies)
Discussion started by: serm
2 Replies

2. UNIX for Dummies Questions & Answers

Can any good awk'er resolve this issue?

awk -F^ '{ if ((($1 != "M") && ($5 != "2")) || (($1 != "S") && ($5 != "7"))) print $0}' welcome > welcome1 The "&&" and "||" in the above command is not working with awk. When I run the above command, the same content of welcome is copied to welcome1 without any difference. Your reply is... (12 Replies)
Discussion started by: karthickrn
12 Replies

3. Shell Programming and Scripting

Does awk ever resolve params ?..

Hi, Does awk ever resolve params in the search pattern?.. The following awk doesnt know how to resolve ${tables}$ inside a loop. k=`awk '/${tables}$/ ${graph}` The search pattern has ${tables}$ and I am narrowing down my search with a $ at the end of string. So...this leaves me with a... (13 Replies)
Discussion started by: anduzzi
13 Replies

4. Shell Programming and Scripting

The awk subtraction giving exponential values.Please help resolve it

Hi friends, I have a file list1 which has these 2 columns like 616449 0 434453 1 2151083 0 2226536 0 2132382 0 2136814 0 I have to put the result of col1 -col2 into another file list2 linewise. e.g. It gives the below result if use the below code: awk '{ print $1 - $2 }' list1 >... (2 Replies)
Discussion started by: kunwar
2 Replies

5. Shell Programming and Scripting

using awk for setting variable but change the output of this variable within awk

Hi all, Hope someone can help me out here. I have this BASH script (see below) My problem lies with the variable path. The output of the command find will give me several fields. The 9th field is the path. I want to captured that and the I want to filter this to a specific level. The... (6 Replies)
Discussion started by: Cowardly
6 Replies

6. Shell Programming and Scripting

Resolve Environment Variable

I am tyring to resolve an environment variable that is part of a string I selected from our database. Simply put, I want cd to this folder before checking if a file exists. The variable $in_loc has the value '$PS_HOME/int/VSP' where $PS_HOME is the environment variable. I am using cd... (6 Replies)
Discussion started by: consult_jb
6 Replies

7. Shell Programming and Scripting

Resolve variable inside another variable

Hello Everyone, I am trying to resolve a variable inside another variable.Let me go straight to the example. Input: Query=$Table_1 Join $Table_2 (Query itself is a variable here) Now for two different cases I am assigning different values to Table_1 and Table_2 Case 1:... (14 Replies)
Discussion started by: vinay4889
14 Replies

8. Shell Programming and Scripting

Resolve parameter value stored in a variable

Hi All, I have below variable, xyz=\$AI_XFR Now, if you will run the below command => echo $xyz $AI_XFR It is returning hardcoded string value. Whereas in environment, there is value in it. Like below: => echo $AI_XFR /home/aditya/sandbox/xfr/ I need to resolve this... (4 Replies)
Discussion started by: adgangwar
4 Replies

9. Shell Programming and Scripting

Cannot resolve $var in awk

My script ---------- for i in `cat n`;do export k=`echo "CSN: "$i` //combining CSN: and value from n echo "$k" awk ''{print "CSN: "$0;}'{_=29}_&&_--' file1|tail -1 >> file2 done In the above script i cannot able to resolve $k in awk command file n contains ------------ 0000 1111... (0 Replies)
Discussion started by: Mohana29_1988
0 Replies

10. UNIX for Beginners Questions & Answers

How can I assign awk's variable to shell script's variable?

I have the following script, and I want to assign the output ($10 and $5) from awk to N and L: grdinfo data.grd | awk '{print $10,$5}'| read N L output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)
Discussion started by: geomarine
8 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 08:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy