Sponsored Content
Top Forums Shell Programming and Scripting Comparing content of two variables Post 302542884 by animesharma on Friday 29th of July 2011 01:01:08 AM
Old 07-29-2011
It will just print

What i need is for this code:
echo "a1 is " $a1

output i have now:I have reached up to here)
a1 is a1

output i need now is:
a1 is 1

If i change your code to
grep -wq "$arg" file1.txt && echo $arg=$val > file_out && source file_out

I will get what i need.
But again. there is one more problem.. since i am not experienced with grep, i will need your help.
my file1.txt is actually like this:
$source_dir/script_B_1 a1 >$output_dir/scriptb1
$source_dir/script_B_2 a2 b2 >$output_dir/scriptb2
$source_dir/script_B_3 a3 b3 c3 >$output_dir/scriptb3

Now i need to extract just the arguments in file_out.
how to proceed?

Last edited by animesharma; 07-29-2011 at 02:14 AM..

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comparing file content differences

I need to write a script to find out if there are any .c files created/removed from the last time i monitored the files available. i first created a file to contain all the .c files available on the system. (ls *.c > file1) I created another file using the same command. I used the comm file1... (4 Replies)
Discussion started by: RianTan
4 Replies

2. UNIX for Dummies Questions & Answers

comparing variables

I have searched and found a few threads that have dealt with this, but the examples I've tried haven't seemed to help. I am monitoring our database log for high checkpoints. I can parse out the checkpoint value which can be anywhere from zero into a 3 digit number. I set a variable to be the... (3 Replies)
Discussion started by: MizzGail
3 Replies

3. Shell Programming and Scripting

Comparing two variables

Script #!/bin/sh hardware=PC os=WindowsNET for i in `cat newservers` do x=`sudo /opt/openv/netbackup/bin/admincmd/bpplclients |grep $i |head -40 |grep $i|awk '{print $3;exit}'` if then echo "$i is already added" else echo "Need to add" fi done O/p in debug mode bash-2.05$... (3 Replies)
Discussion started by: rajip23
3 Replies

4. Shell Programming and Scripting

comparing content of 2 variables in script

hello how can i compare the content of two variables using the if or for loops. I have 2 variables which was formed as result of commands pass into them but i want to now compare the 2 contents and echo where their is a match for examples variable1=`cat file2` variable2=`cat file3` if #... (5 Replies)
Discussion started by: sam4now
5 Replies

5. UNIX for Dummies Questions & Answers

comparing the content of two directories

Hello I want to compare the content of two directories recursively to check if the two directories have the same files. How can I do that? (2 Replies)
Discussion started by: xyzt
2 Replies

6. Shell Programming and Scripting

comparing files content

hi i have a set of files , i need to compare one file content with other file content, i am using cmp -s abc.1 def.2 , but it is not giving theproper o/p even if the content is different.Please help thanks Satya (1 Reply)
Discussion started by: Satyak
1 Replies

7. UNIX for Dummies Questions & Answers

comparing variables

im trying to compare ipaddresses. i loop through an array to see if the ip is already is in the array and if it is it should set a flag and then i wont add it to the array. but its just adding all the ipaddresses to the array if ] then ... (3 Replies)
Discussion started by: magnia
3 Replies

8. Shell Programming and Scripting

Comparing 2 csv files and matching content

Hello, I have the following problem: There are two csv files csv-file #1: aaa1, aaa2, ... aaan aaa1, bbb2, ... bbbn aaa1, ccc2, ... cccn bbb1, bbb2, ... bbbn ... zzz1, zzz2, ... zzzn csv-file #2: aaa1, matchvalue1 ccc1, matchvalue2 (7 Replies)
Discussion started by: ghl10000
7 Replies

9. Shell Programming and Scripting

comparing 2 files and creating third file with uncommon content

I want to compare 2 files and create third file with uncommon content. e.g. file1 ajay suhas tom nisha vijay mahish file2 ajay suhas tom nisha expected output file content vijay mahish Is it possible in single command ? Thanks, Ajay (6 Replies)
Discussion started by: ajaypatil_am
6 Replies

10. Shell Programming and Scripting

Comparing two variables

I have a script like this. Just couldn't get the comparison part work. Any thought? thanks, #!/usr/bin/ksh -x STEP=`echo $(basename $0 .ksh) | tr "" ""` log=/skip.log while read LINE do if then echo `date`: STEP $STEP skipped by user >> $log exit 0 fi done < $1 echo... (0 Replies)
Discussion started by: ghostmic
0 Replies
Locale::Codes::LangVar(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangVar(3pm)

Locale::Codes::LangVar - standard codes for language variation identification SYNOPSIS
use Locale::Codes::LangVar; $lvar = code2langvar('acm'); # $lvar gets 'Mesopotamian Arabic' $code = langvar2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langvar_codes(); @names = all_langvar_names(); DESCRIPTION
The "Locale::Codes::LangVar" module provides access to standard codes used for identifying language variations, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language variations. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lvar = code2langvar('en','alpha-2'); $lvar = code2langvar('en',LOCALE_CODE_ALPHA_2); The codesets currently supported are: alpha This is the set of alphanumeric codes from the IANA language registry, such as 'arevela' for Eastern Armenian. This code set is identified with the symbol "LOCALE_LANGVAR_ALPHA". This is the default code set. ROUTINES
code2langvar ( CODE [,CODESET] ) langvar2code ( NAME [,CODESET] ) langvar_code2code ( CODE ,CODESET ,CODESET2 ) all_langvar_codes ( [CODESET] ) all_langvar_names ( [CODESET] ) Locale::Codes::LangVar::rename_langvar ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangVar::add_langvar ( CODE ,NAME [,CODESET] ) Locale::Codes::LangVar::delete_langvar ( CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_alias ( NAME ,NEW_NAME ) Locale::Codes::LangVar::delete_langvar_alias ( NAME ) Locale::Codes::LangVar::rename_langvar_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::delete_langvar_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2014-01-06 Locale::Codes::LangVar(3pm)

Featured Tech Videos

All times are GMT -4. The time now is 07:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy