Sponsored Content
Top Forums Shell Programming and Scripting Passing awk variables to shell Post 302603357 by jayan_jay on Wednesday 29th of February 2012 08:36:04 PM
Old 02-29-2012
Provide some input file contents and expected output ..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing Variables to AWK

Does anybody have an explanation for the following: The following scripts runs fine on IRIX64 6.5 but has bugs on Solaris 8. #! /bin/sh echo run only on an SGI machine echo type in linenumber read j echo value read value awk -f rmspass2 level=$value $j'step1.mlf' When the script is... (5 Replies)
Discussion started by: AreaMan
5 Replies

2. Shell Programming and Scripting

Passing shell variables to awk program..

Hello, Can we pass shell variables like $PATH etc. to a awk program part for example, awk ' { fieldValue=$PATH .... }' file (1 Reply)
Discussion started by: Vishnu
1 Replies

3. Shell Programming and Scripting

Passing Variables to Awk

Hi I have a unix shell script with an awk statement. I would like to print some of the fields of an input file. However, I would like to print them dynamically, ie by passing the literal $1 $3 into the script to define the output. I have tried the following: variable1='$1' awk... (2 Replies)
Discussion started by: Bab00shka
2 Replies

4. Shell Programming and Scripting

Passing awk Variables

I am trying to pass the results from a variable gathered from awk, however when I echo the 'PARSE' and 'SUB', the response is blank. This is my command. awk -F= '/Unit/''{ PARSE=substr($2,1,5) ; SUB=substr($2,1,1) }' inputfile.lst Is this a kind of valid attempt or am I obligated to declare... (3 Replies)
Discussion started by: gozer13
3 Replies

5. UNIX for Dummies Questions & Answers

Passing Shell Variables to an awk command

Hello, I have two files File1 & File2. File1 76 135 136 200 250 345 .... File2 1 24 1 35 1 36 1 72 .... I want to get all the values form File2 corresponding to the range in File 1 and feed it to a program. Is the code below right? Can I pass shell variables to awk in this... (2 Replies)
Discussion started by: Gussifinknottle
2 Replies

6. Shell Programming and Scripting

ksh passing to awk multiple dyanamic variables awk -v

Using ksh to call a function which has awk script embedded. It parses a long two element list file, filled with text numbers (I want column 2, beginning no sooner than line 45, that's the only known thing) . It's unknown where to start or end the data collection, dynamic variables will be used. ... (1 Reply)
Discussion started by: highnthemnts
1 Replies

7. Shell Programming and Scripting

Passing variables into AWK

I'm trying to use awk to write new entries to a hosts file if they don't exist. I need to do so depending on the type of system I have. Below is what I have, but it isn't working. awk -v myip1=$IP1 myip2=$IP2 myhost1=$HOST1 myhost2=$HOST2' BEGIN { mqhost1=0; mqhost2=0; stap1=0; stap2=0; } ... (4 Replies)
Discussion started by: Boomn4x4
4 Replies

8. UNIX for Dummies Questions & Answers

Passing Global Shell variables to awk

Hi All, Iam trying to pass global shell variables and is not working Main script is like below CYEAR=`date +"%y"` CFYEAR=`date +"%Y"` CMONTH=`date +"%m"` if then PMONTH=12 PYEAR=`expr $CYEAR - 1` PFYEAR=`expr $CFYEAR - 1` else PMONTH=`expr... (6 Replies)
Discussion started by: baanprog
6 Replies

9. Shell Programming and Scripting

Passing awk variables to bash variables

Trying to do so echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies

10. Shell Programming and Scripting

Awk: passing shell variables through and extracting text

Hello, new to the forums and to awk. Glad to be here. :o I want to pass two shell (#!/bin/sh) variables through to awk and use them. They will determine where to start and stop text extraction. The code with the variables hard-coded in awk works fine; the same code, but with the shell... (7 Replies)
Discussion started by: bedtime
7 Replies
dtoc(1) 						      General Commands Manual							   dtoc(1)

Name
       dtoc - unpack objects from a DOTS file

Syntax
       dtoc [ -f ] [ -p ] [[ object.dots ] directory ]

Description
       The command unpacks the contents of a Data Object Transport Syntax (DOTS) file or standard input.

       object.dots  can  be  either a file name, or a minus sign (-).  If a minus sign (-) is specified, or if no file name is present, reads from
       the standard input.  If directory is specified, the contents of the DOTS input is unpacked and  stored  in  the	specified  directory.	If
       directory is not specified, the content of the DOTS input is unpacked into the current directory.  The names of the files created are writ-
       ten to standard output.

       A DOTS file may contain a data object which consists of more than one component.  Therefore, it is possible that more than one output  file
       may  be	generated.  As the object is unpacked, duplicate file or directory names may be encountered.  If a duplicate is encountered, a new
       output file is generated with a sequential number appended to its name.	For example, if discovers an existing file  during  unpacking,	is
       created.

       As  an  object  is unpacked, the external references within each object component are updated.  Because DOTS files may have originated from
       non-ULTRIX systems, names of components may be modified as components are unpacked.  References to those  renamed  components  are  updated
       accordingly.

Options
       -f   Suppresses output of unpacked file names.

       -p   Causes only the name of the primary input file to be written to standard output.

Implementation
   Standard Input
       If  a minus sign (-) is specified, or if no parameters are specified, standard input is read until a or EOF (end of file) is read.  It can-
       not be specified more than once.  The contents of standard input must conform to the syntax of a single DOTS file.

   Reconstitution Of Names
       Object file names and file names of referenced components may be modified as objects are extracted or unpacked.	If names are modified, the
       references in the unpacked objects are updated.	The handling of names depends in part on the name-type of the object, as follows:

	      ULTRIX file names

		     Names are unmodified.

	      VMS file names

		     The set of rules is as follows:

			    Convert uppercase letters to lower case.

			    Convert dollar signs ($) to underscores (_) because dollar signs have meaning on ULTRIX systems.

			    Ignore  disk volume and directory specifications, if they are present, because they are not likely to be meaningful on
			    ULTRIX systems.

			    Append duplicate file names with a period and a unique number.

			    Leave all other characters alone.

Restrictions
       A DOTS file is expected to contain only a single primary DDIF or DTIF object in this release.  Any subsequent objects in the DOTS file  are
       external references of the primary object.

Diagnostics
       The  exit status is 0 if all objects were unpacked successfully, and 1 if any of the objects could not be unpacked.  Consult standard error
       to see what failed, and why.

       If a nonexistent target directory is specified, returns error status.

See Also
       ctod(1), DDIF(5), DTIF(5), DOTS(5)

																	   dtoc(1)
All times are GMT -4. The time now is 01:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy