Sponsored Content
Top Forums UNIX for Dummies Questions & Answers using awk iteratively in a script to assign variable values Post 302570228 by pts2 on Wednesday 2nd of November 2011 05:14:07 PM
Old 11-02-2011
thanks for that suggestion!

When I try that, I get errors:


Code:
awk "BEGIN {inside=0} $3 ~ /start/ {inside=1} $3 ~ /bad_trial/ {inside=0} {if (inside==1) {print $1 FS $4}" lamar-Training_5seq.log
awk: syntax error at source line 1
 context is
	BEGIN {inside=0}  >>>  ~ <<< 
	missing }
awk: bailing out at source line 1

What is wrong here?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read a file and assign the values to a variable

i have a file in this format curyymm PRVYYMM CDDMmmYY bddMmmyy eddMmmyy --------- ------- ------------ ---------- ----------- 0906 0905 09Jun09 01Jun09 30Jun09 ----------- --------- ------------ ------------ ----------- i need to read the... (5 Replies)
Discussion started by: depakjan
5 Replies

2. Shell Programming and Scripting

Read the csv file and assign the values in to variable

I have a csv file with the values seperated by commas.I want to extract these values one by one and assign to a variable using shell script.Any ideas or code? (11 Replies)
Discussion started by: rajbal
11 Replies

3. Shell Programming and Scripting

assign awk's variable to shell script's variable?

Dear All, we have a command output which looks like : Total 200 queues in 30000 Kbytes and we're going to get "200" and "30000" for further process. currently, i'm using : numA=echo $OUTPUT | awk '{print $2}' numB=echo $OUTPUT | awk '{print $5}' my question is : can I use just one... (4 Replies)
Discussion started by: tiger2000
4 Replies

4. Shell Programming and Scripting

Assign values to variable

Hi Masters, I want to assign the values of one variable to another variable. Here the varaible name 'var' is dynamic. I know the values of V_2 and U_3, but If the i/p of TYPE is 'U' and the NO is 3, then I want to assign the values of U_3 to var. How we can achieve it? TYPE="U"... (4 Replies)
Discussion started by: ecearund
4 Replies

5. UNIX for Advanced & Expert Users

How to read a text file and assign the values in the same to a variable in loop

Hi, I have a text file with multiple lines, each having data in the below format <DOB>,<ADDRESS> I have to write a script which reads each line in the text file in loop, assign the values to these variables and do some further processing in it. Using the following code prints the values... (12 Replies)
Discussion started by: manishab00
12 Replies

6. UNIX for Dummies Questions & Answers

How to assign values to variable in given scenario

Hi i have one variable like DIR="f1 f2" in config file in my script i have one runtime variable LFILE="DIR" now i want to use $DIR in my script by using LFILE that is i dont want to use DIR dirctly i am extracting DIR by some other means. Config file : DIR="f1 f2" Script: LFILE="DIR" i... (3 Replies)
Discussion started by: sriram_gec
3 Replies

7. Shell Programming and Scripting

Assign comma separated values to a variable

Hi All, I wrote a database command that queries our application and outputs a whole bunch of values to a text file. I need to assign the output to two values. Here is a sample of the output: valueOne, checkOne valueTwo, checkTwo valueThree, checkThree I would like... (9 Replies)
Discussion started by: jeffs42885
9 Replies

8. Shell Programming and Scripting

Assign Values to a Variable in While Loop and Update the File

Hello, Could anyone please help me with Assigning a value to variable and then updating the value in the original file IFS='|' while read -r Serial_ID JOB_NAME STATUS do if then echo "Perform Fuctions" ???Assign STATUS to COMPLETED and Update File??? done <File (7 Replies)
Discussion started by: infernalhell
7 Replies

9. 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

10. Shell Programming and Scripting

How to assign awk values to shell variable?

Hi Gurus, I have a script which assign awk output to shell variable. current it uses two awk command to assign value to two variables. I want to use one command to assign two values to two variables. I tried the code, but it does't work. kindly provide your suggestion. current code... (2 Replies)
Discussion started by: green_k
2 Replies
JODREPORTS(1)						      General Commands Manual						     JODREPORTS(1)

NAME
jodreports - use libjodreports-java directly from the command line to merge OpenDocument text with data SYNOPSIS
jodreports <template-document> <data-file> <output-document> DESCRIPTION
jodreports is a java program that merge OpenDocument text with data by using libjodreports-java. The command line tool is especially useful to test templates while you are adding instructions to them. You use a .properties or .xml file to contain the <data-file> to be merged into the template. The <template-document> needs to be an existing OpenDocument text with simple fields. A field that will be replaced with the value of a variable passed can be specified using the standard FreeMarker expression notation by typing the variable name into the doc- ument as follows Hi ${name}! here name will be replaced with the value passed in at runtime. However, mixing processing instructions and normal text into the document may become confusing and clutter the layout. So JOOReports pro- vides an alternative way of inserting fields. You can insert a visual field in OpenOffice.org Writer from the menu Insert / Fields / Other... (or just press Ctrl+F2), then click on the Functions tab and select Input field. Change the field Reference to JOOScript and in the following field Content enter the variable name (e.g. "$name"). This field will typically be displayed by Writer as a grayed rectangle with the variable name, while moving the mouse over it will reveal the field reference. This is a nice way of keeping processing instructions separate from the document layout and is thus the recommended approach. Whatever you specify as the field Reference will be treated as a FreeMarker ${...} expression, so it could also be something more complex than a simple variable name. To insert more advanced instructions, e.g. for conditionally displaying a portion of text, or repeating a table row for each item in a col- lection, you can use FreeMarker directives. A simple directive is assign. You can use it to define a new variable, for example [#assign totalPrice = unitPrice * quantity] Note that we always use the alternative (square bracket) syntax for FreeMarker directives. While it may be possible to insert this directive directly as text into the template, this does not always work (for reasons we'll see below) and as mentioned mixing instructions into the document is a practice we want to avoid anyway. For this reason, JOOReports lets you insert FreeMarker directives as scripts. You can insert a script in Writer from the menu Insert / Script..., then change the Script type to JOOScript and insert any FreeMarker directives in the script Text box. A script will be displayed by Writer as a small green rectangle, and you can double click on it to open it and modify it. So you directive will be executed at the point where the script has been inserted. This is ok for something like assign but as we'll see will not work for something like list. Alternatively, you can insert a FreeMarker directive in OpenOffice.org Writer from the menu Insert / Fields / Other... (or just press Ctrl+F2), then click on the Functions tab and select Input field. Change the field Reference to JOOScript and in the following field Con- tent enter the directive (e.g. "[#assign title='Mr.']"). Sample Open Document Template Again this provides a nice way to insert processing instructions and keept them separate from the document layout. The <output-document> is also an OpenDocument text and will be created as the result of the merge. JOOReports uses FreeMarker as its template engine. FILES
/usr/share/java/jodreports.jar AUTHOR
jodreports was written by Mirko Nasato <mirko@artofsolving.com> and Terry Liang <terry@polonious.com.au>. jodreports was packaged for the Debian project by Sascha Girrulat <sascha@girrulat.de>. This manual page was written by Sascha Girrulat <sascha@girrulat.de>, for the Debian project (and may be used by others). Most of the used information are reused from http://jodreports.sourceforge.net. User Manuals January 30, 2011 JODREPORTS(1)
All times are GMT -4. The time now is 10:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy