Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Need to pass variable in a command and assign value to a variable Post 302999797 by ektubbe on Wednesday 28th of June 2017 05:30:05 AM
Old 06-28-2017
Thank you RudiC and bakunin, but it did not solve my problem

Hello both,

Thank you for writing back, the last line i.e. head -35 should return with a record like I am mentioning below - Record 1:

Code:
HTML Code:
[record
  bdfo_len      73
  bdfo_key      "     200000016"
  bdfo_param_no "000"
  parm01        NULL
  parm02        NULL
  parm03        NULL
  parm04        NULL
  parm05        NULL
  parm06        NULL
  parm07        NULL
  parm08        NULL
  parm09        NULL
  parm13        NULL
  parm16        NULL
  parm017       NULL
  parm18        NULL
  parm93        NULL
  parm94        NULL
  parm96        NULL
  parm97        NULL
  parm83        NULL
  header        [record
                  bdfo_run_date     41991
                  bdfo_file_id      "GYFL3027"
                  bdfo_centre_id    "G"
                  bdfo_sbi_file_ind "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"]
  trailer       NULL
  data          NULL]

which is of 35 lines and constitues to first record of the file we are trying to read using m_dump, I need to place the file name using command line and as per Bakunin's suggestion I tried using below code but it did not work -
Code:
param1 = $inputfile1
param2  = $inputfile2
param3 = $inputfile3
header_date_14=$(m_dump /wload/baot/app/data_abinitio/serial/uk_cust/ukrb_ukba_acnt_bde27_src.dml $'$param1' | head -35)
header_date_15=$(m_dump /wload/baot/app/data_abinitio/serial/uk_cust/ukrb_ukba_acnt_bde27_src.dml $'$param2' | head -35)
header_date_16=$(m_dump /wload/baot/app/data_abinitio/serial/uk_cust/ukrb_ukba_acnt_bde27_src.dml $'$param3' | head -35)

Once this command is executed, I need to take out bdfo_run_date 41991 to display it...

Thank you in advance !
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

assign awk command result to a variable

#!/bin/sh # ## MYSTRING = `awk '/myApp.app/' /Users/$USER/Library/Preferences/loginwindow.plist` if then echo String not found defaults write /Users/$USER/Library/Preferences/loginwindow AutoLaunchedApplicationDictionary -dict-add -string Hide -bool YES -string Path -string... (9 Replies)
Discussion started by: dedmakar
9 Replies

2. Shell Programming and Scripting

Assign bash command to variable

Hi I am trying to write a function that needs to be able to assign the last run shell command to a variable. The actual command string itself not the exit code of the command. I am using the bash command recall ability to do this as follows: alias pb='ps | grep ash' ... (3 Replies)
Discussion started by: Moxy
3 Replies

3. UNIX for Dummies Questions & Answers

Cut Command value assign to variable

Hi, I am new to UNIX Scripting. I have been trying to use the CUT command to retrieve part of the header from a file and assign it to a variable. I have tried searching a lot, but I am still unsuccessful. Sample Header: HJAN BALANCE 20090616 I need to retrieve the date here, which always... (10 Replies)
Discussion started by: ragz_82
10 Replies

4. Shell Programming and Scripting

Assign command (with pipe) output to a variable

Hi , I would like to assign command (with pipe) output to a variable. The code is as follows. The goal of the code is to get the last folder folder with a particular name pattern. myDate=`ls | grep 2009 | tail -1` echo "myDate=" $myDate However, in the presence of the pipe, the code... (3 Replies)
Discussion started by: jeff_cen
3 Replies

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

6. Red Hat

How to pass value of pwd as variable in SED to replace variable in a script file

Hi all, Hereby wish to have your advise for below: Main concept is I intend to get current directory of my script file. This script file will be copied to /etc/init.d. A string in this copy will be replaced with current directory value. Below is original script file: ... (6 Replies)
Discussion started by: cielle
6 Replies

7. Shell Programming and Scripting

Unable to assign command output to variable

Code set -x STATUS="0" echo $STATUS for i in `ls -ltr Report*|awk '{ print $9 }'` do if then flg = "`head -1 "$i" |cut -c 31-33`" echo `head -1 "$i" |cut -c 31-33` echo $flg if then echo "having Fun" STATUS="2" else echo "no Fun" fi fi (2 Replies)
Discussion started by: Funkeydude
2 Replies

8. Shell Programming and Scripting

Assign the result of a multiline command to a variable

Hi, I have the following command that lists all the .o files from all the directories except of vwin (which I don't want it) for i in `ls -d */*.o|awk '$0 !~ "vwin"'`; do echo $i; done The result is something like that dir1/file1.o dir1/file2.o dir2/file3.o etc. So, I want to create a... (9 Replies)
Discussion started by: scor6800
9 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. UNIX for Beginners Questions & Answers

Assign a command to a variable - Help

Hi, I have the script below. When i assign SSH_COMMAND to "ssh -o ConnectTimeout=2 ${SERVER} ${AS_SUDO} ${COMMANDS}" and then execute it as ${SSH_COMMAND} I get the following error: ssh: Could not resolve hostname sudo: Name or service not known ssh: Could not resolve hostname sudo: Name or... (3 Replies)
Discussion started by: mohca2020
3 Replies
XmScrolledWindow(3)						  LessTif Manuals					       XmScrolledWindow(3)

NAME
XmScrolledWindow - Motif-compatible scrolled-window widget SYNOPSIS
#include <Xm/ScrolledW.h> XmScrolledWindow XmCreateScrolledWindow DESCRIPTION
XmScrolledWindow X RESOURCES
Name Class Type Default Access ---------------------------------------------------------------------------------------------------------- XmNhorizontalScrollBar XmCHorizontalScrollBar Widget NULL CSG XmNverticalScrollBar XmCVerticalScrollBar Widget NULL CSG XmNworkWindow XmCWorkWindow Widget NULL CSG XmNclipWindow XmCClipWindow Widget NULL CSG XmNscrollingPolicy XmCScrollingPolicy ScrollingPolicy NULL CSG XmNvisualPolicy XmCVisualPolicy VisualPolicy NULL CSG XmNscrollBarDisplayPolicy XmCScrollBarDisplayPolicy ScrollBarDisplayPolicy NULL CSG XmNscrollBarPlacement XmCScrollBarPlacement ScrollBarPlacement NULL CSG XmNscrolledWindowMarginWidth XmCScrolledWindowMarginWidth HorizontalDimension NULL CSG XmNscrolledWindowMarginHeight XmCScrolledWindowMarginHeight VerticalDimension NULL CSG XmNspacing XmCSpacing HorizontalDimension NULL CSG XmNshadowThickness XmCShadowThickness HorizontalDimension NULL CSG XmNtraverseObscuredCallback XmCCallback Callback NULL CSG XmNhorizontalScrollBar XmNverticalScrollBar XmNworkWindow XmNclipWindow XmNscrollingPolicy XmNvisualPolicy XmNscrollBarDisplayPolicy XmNscrollBarPlacement XmNscrolledWindowMarginWidth XmNscrolledWindowMarginHeight XmNspacing XmNshadowThickness XmNtraverseObscuredCallback CLASS HIERARCHY
Object(3) Rect(3) UnNamedObj(3) Core(3) Composite(3) Constraint(3) XmManager(3) XmScrolledWindow(3) CALLBACKS
CONVENIENCE FUNCTIONS
SEE ALSO
LessTif Project April 1998 XmScrolledWindow(3)
All times are GMT -4. The time now is 02:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy