Sponsored Content
Top Forums Shell Programming and Scripting Piping to a file and setting filename using a variable Post 302236251 by mandriver on Monday 15th of September 2008 06:22:00 AM
Old 09-15-2008
hi guys, thanks for the responses.

The below works fine with a simple command such as ls -l:

Code:
ls -l > ${MYVAR}.arc

But when I attempt to send the output of an awk command to a similarly named file, the file is created, but it is empty:

Code:
 
awk -v s=$string 'BEGIN{FS=OFS="|"}!/T00:00:00/{$NF=s}1' *.arc > ${FILENAME}.arc

The same happens using $FILENAME".arc"

Any ideas why this is happening?

Thanks all
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

setting file count to a variable

Hey guys. My goal here is to count the number of .dat files in in a directory(28 files). If 28 files exist I am ok. Having trouble doing this. Any help would b e greatly appreciated. #!/usr/bin/ksh #============================================================================= ### Define local... (3 Replies)
Discussion started by: ecupirate1998
3 Replies

2. Shell Programming and Scripting

piping output from PHP file into variable

Hi. I have a script like so: #!/bin/bash download='php /var/www/last.php' echo $download if $downloadHow do I pipe the output of the php file into a variable, as when i run the if statement, it just echos the file output to the screen and does not actually consider the output (it will be... (2 Replies)
Discussion started by: daydreamer
2 Replies

3. Shell Programming and Scripting

Setting Variable to oldest file in a directory

I am using a bash script to perform some automated maintenance on files in a directory. When I run the script using $sh -x script.sh <directory> the script works fine. It sets the variable to the oldest file, and continues on. However when I run the script like this $./script.sh <directory>, it... (5 Replies)
Discussion started by: spaceherpe61
5 Replies

4. Shell Programming and Scripting

setting a variable by searching within a file

Hi, I am trying to set a variable to be used in later scripting, and am having some difficulty. I want to look in a file called scan.info and find the line that says "variable ok". Then I want to cut the number at the beginning of that line and assign that number as a variable so that later... (4 Replies)
Discussion started by: garth6@hotmail.
4 Replies

5. Shell Programming and Scripting

Help setting variable from file contents with spaces

I suppose the easiest way to explain my problem is to show you some code and then show you what the code outputs: -------------------------------------------------- #!/bin/bash echo "This line has spaces" > "/tmp/This Filename Has Spaces.txt" export Foo=$(cat "/tmp/This Filename Has... (4 Replies)
Discussion started by: nrogers64
4 Replies

6. Shell Programming and Scripting

Setting Environment variable from value in file

I've searched Google and now this forum. Best guess is my search fu is not good (and it probably isn't). The Google search did bring me here. Background I have a number of Korn Shell scripts who all use one of 3 values for an environment variable used in the backup system. On occasion one or... (8 Replies)
Discussion started by: WolfBrother
8 Replies

7. Homework & Coursework Questions

Matlab help! Reading in a file with a variable filename

1. The problem statement, all variables and given/known data: I want to read in a file, and plot the data in matlab. However, I do not like hardwiring filenames into my codes, so I always give the user the option to specify what the filename is. I am pretty inexperienced with matlab, so I have no... (0 Replies)
Discussion started by: ds7202
0 Replies

8. Shell Programming and Scripting

Non trivial file splitting, saving with variable filename

Hello, Although I have found similar questions, I could not find advice that could help with our problem. The issue: We have a few thousands text files (books). Each book has many chapters. Each chapter is identified by a cite-key. We need to split each of those book files by... (4 Replies)
Discussion started by: samask
4 Replies

9. UNIX for Advanced & Expert Users

Problem piping find output to awk, 1st line filename is truncated, other lines are fine.

Today I needed to take a look through a load of large backup files, so I wrote the following line to find them, order them by size, and print the file sizes in GB along with the filename. What happened was odd, the output was all as expected except for the first output line which had the filename... (4 Replies)
Discussion started by: gencon
4 Replies

10. Shell Programming and Scripting

Need help piping a value to a variable

Hey Guys. Below is the code I am using to pipe a value into a variable. When I tried it says the following xargs: :HEX:: No such file or directory Not sure what it means. Can anyone please help me figure this out. Below is the code I am using. (It echo's out just fine) sed -n... (1 Reply)
Discussion started by: eldan88
1 Replies
mlib_GraphicsDrawArc(3MLIB)											       mlib_GraphicsDrawArc(3MLIB)

NAME
mlib_GraphicsDrawArc, mlib_GraphicsDrawArc_8, mlib_GraphicsDrawArc_32, mlib_GraphicsDrawArc_X_8, mlib_GraphicsDrawArc_X_32, mlib_Graphics- DrawArc_A_8, mlib_GraphicsDrawArc_A_32, mlib_GraphicsDrawArc_B_8, mlib_GraphicsDrawArc_B_32, mlib_GraphicsDrawArc_AB_8, mlib_Graphics- DrawArc_AB_32 - draw arc SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_GraphicsDrawArc_8(mlib_image *buffer, mlib_s16 x, mlib_s16 y, mlib_s32 r, mlib_f32 t1, mlib_f32 t2, mlib_s32 c); mlib_status mlib_GraphicsDrawArc_32(mlib_image *buffer, mlib_s16 x, mlib_s16 y, mlib_s32 r, mlib_f32 t1, mlib_f32 t2, mlib_s32 c); mlib_status mlib_GraphicsDrawArc_X_8(mlib_image *buffer, mlib_s16 x, mlib_s16 y, mlib_s32 r, mlib_f32 t1, mlib_f32 t2, mlib_s32 c, mlib_s32 c2); mlib_status mlib_GraphicsDrawArc_X_32(mlib_image *buffer, mlib_s16 x, mlib_s16 y, mlib_s32 r, mlib_f32 t1, mlib_f32 t2, mlib_s32 c, mlib_s32 c2); mlib_status mlib_GraphicsDrawArc_A_8(mlib_image *buffer, mlib_s16 x, mlib_s16 y, mlib_s32 r, mlib_f32 t1, mlib_f32 t2, mlib_s32 c); mlib_status mlib_GraphicsDrawArc_A_32(mlib_image *buffer, mlib_s16 x, mlib_s16 y, mlib_s32 r, mlib_f32 t1, mlib_f32 t2, mlib_s32 c); mlib_status mlib_GraphicsDrawArc_B_8(mlib_image *buffer, mlib_s16 x, mlib_s16 y, mlib_s32 r, mlib_f32 t1, mlib_f32 t2, mlib_s32 c, mlib_s32 a); mlib_status mlib_GraphicsDrawArc_B_32(mlib_image *buffer, mlib_s16 x, mlib_s16 y, mlib_s32 r, mlib_f32 t1, mlib_f32 t2, mlib_s32 c, mlib_s32 a); mlib_status mlib_GraphicsDrawArc_AB_8(mlib_image *buffer, mlib_s16 x, mlib_s16 y, mlib_s32 r, mlib_f32 t1, mlib_f32 t2, mlib_s32 c, mlib_s32 a); mlib_status mlib_GraphicsDrawArc_AB_32(mlib_image *buffer, mlib_s16 x, mlib_s16 y, mlib_s32 r, mlib_f32 t1, mlib_f32 t2, mlib_s32 c, mlib_s32 a); Each of the mlib_GraphicsDrawArc_*() functions draws an arc with the center at (x, y), radius r, start angle t1, and end angle t2. Each of the mlib_GraphicsDrawArc_X_*() functions draws an arc in Xor mode as follows: data[x,y] ^= c ^ c2 Each of the mlib_GraphicsDrawArc_A_*() functions draws an arc with antialiasing. Each of the mlib_GraphicsDrawArc_B_*() functions draws an arc with alpha blending as follows: data[x,y] = (data[x,y] * (255 - a) + c * a) / 255 Each of the mlib_GraphicsDrawArc_AB_*() functions draws an arc with antialiasing and alpha blending. Each of the functions takes some of the following arguments: buffer Pointer to the image into which the function is drawing. x X coordinate of the center. y Y coordinate of the center. r Radius of the arc. t1 Start angle of the arc in radians. t2 End angle of the arc in radians. c Color used in the drawing. c2 Alternation color. a Alpha value for blending. 0 <= a <= 255. Each of the functions returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ mlib_GraphicsDrawCircle(3MLIB), mlib_GraphicsDrawEllipse(3MLIB), attributes(5) 3 Mar 2005 mlib_GraphicsDrawArc(3MLIB)
All times are GMT -4. The time now is 03:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy