Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to grep variable in shell script? Post 303014857 by RudiC on Thursday 22nd of March 2018 02:44:40 AM
Old 03-22-2018
You have a leading space in d that doesn't seem to exist in your file.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep results to store in a shell variable

I have the results of a grep with -n store in a shell variable ie VAR=`grep -n -e 'PATTERN' file` How ever I am missing the line breaks in the variable , How do I store the resualts of grep with many lines in to a variables. I want the varable should be the sawmway as we do the grep grep... (3 Replies)
Discussion started by: jojan
3 Replies

2. Shell Programming and Scripting

How to return a value of a variable from shell script to perl script

HI , Is there any way to return a value of variable from shell to perl script. Code: === Perl file my $diff1=system("sh diff.sh"); my $diff2=system("sh diff1.sh"); I need exit status of below commands i.e 0 and 1 respectively. Since in both the cases diff is working so system... (3 Replies)
Discussion started by: srkelect
3 Replies

3. Shell Programming and Scripting

Shell script / Grep / Awk to variable and Loop

Hi, I have a text file with data in that I wish to extract, assign to a variable and process through a loop. Kind of the process that I am after: 1: Grep the text file for the values. Currently using: cat /root/test.txt | grep TESTING= | awk -F"=" '{ a = $2 } {print a}' | sort -u ... (0 Replies)
Discussion started by: Spoonless
0 Replies

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

5. Shell Programming and Scripting

How to grep sql error in shell script and exit the script?

I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts. Here is my script #!/bin/csh -f source .orapass set user = $USER set pass = $PASS cd /opt/data/scripts echo... (2 Replies)
Discussion started by: allinshell99
2 Replies

6. Shell Programming and Scripting

Issue with passing variable to Grep in a shell script

Hi, I'm trying to check if methods specified in a class have been added to the corrosponding interface. My code below is giving me the following errors: grep: function: No such file or directory grep: import($zipfile): No such file or directory grep: function: No such file or... (1 Reply)
Discussion started by: racshot65
1 Replies

7. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

8. Shell Programming and Scripting

Variable not working in grep from script

Hi, If I hard code a value in the grep it works fine from script, when I use variable it doesn't work. On a seperate note, some lines (during testing) works fine from command line but not from scirpt. #!/bin/bash # Will fetch the (oldest - as ls will sort by name by default)Date in the... (7 Replies)
Discussion started by: krish.m
7 Replies

9. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 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
hdf_get_value(3)						  util/neo_hdf.h						  hdf_get_value(3)

NAME
hdf_get_value - Return the value of a node in the data set SYNOPSIS
#include <util/neo_hdf.h> char *hdf_get_value (HDF *hdf, const char *name, const char *defval); ARGUMENTS
hdf -> the dataset node to start from name -> the name to walk the data set to defval -> the default value to return if the node doesn't exist DESCRIPTION
hdf_get_value walks the data set pointed to by hdf via name and returns the string value located there, or defval if the node doesn't exist RETURN VALUE
None SEE ALSO
hdf_set_symlink(3), hdf_get_valuef(3), compareFunc)(3), hdf_dump_str(3), hdf_get_int_value(3), hdf_read_string_ignore(3), hdf_copy(3), hdf_get_node(3), hdf_set_value(3), hdf_obj_child(3), hdf_read_string(3), hdf_set_buf(3), hdf_register_fileload(3), hdf_get_obj(3), hdf_get_attr(3), hdf_obj_top(3), hdf_dump_format(3), hdf_destroy(3), hdf_init(3), hdf_obj_value(3), hdf_write_string(3), hdf_set_val- uevf(3), hdf_sort_obj(3), hdf_write_file_atomic(3), hdf_obj_attr(3), hdf_set_valuef(3), hdf_get_copy(3), hdf_write_file(3), hdf_get_val- uevf(3), hdf_set_int_value(3), hdf_dump(3), hdf_get_value(3), hdf_set_copy(3), hdf_obj_next(3), hdf_search_path(3), hdf_obj_name(3), hdf_set_attr(3), hdf_get_child(3), hdf_remove_tree ClearSilver 12 July 2007 hdf_get_value(3)
All times are GMT -4. The time now is 07:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy