Sponsored Content
Full Discussion: searching and mapping
Top Forums Shell Programming and Scripting searching and mapping Post 302326793 by mamatabbsr on Friday 19th of June 2009 12:42:26 AM
Old 06-19-2009
hi

Ya, actually it's a small part of the whole requirement.
I tried to solve it, but the output that I'm getting is not perfect. Here is the script that I've come up with:

#!/bin/sh
arg_1=$1
echo "arg passed by user is:${arg_1}"
res=$(awk -F= -v name=${arg_1} '$1 == name {value=$2;exit} END { print (value)?value:"not found"}' sample.param)
echo "mapping is $res"
if [ "${res}" = "not found" ]; then
echo "key not found"
help
exit 1
fi

key=Student_${res}
echo "key:${key}:"
param_file=`grep '${key}=' sample.param | awk -F"=" '{print $2}'`
echo "param file is:${param_file}"

---------------------------------------------------------

But the output is not coming properly especially the last result i.e. the value of "param_file" variable which is displayed as blank though the value is present in the param file.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Keyboard Mapping HP-UX

This is truly embarrassing but I have to know the answer anyway :p Can anyone share, how to assign keyboard mapping in hp-ux system? Every time I issue command which contain character "@", it'll go the next line. What I need is how to assign the character "@" to @ as it is supposed to be. ... (2 Replies)
Discussion started by: Olli.Lang
2 Replies

2. Shell Programming and Scripting

Pattern mapping

Dear Friends, Please help me on this I have file A.txt containing text lines as below grectec; 30 ,50, 60, base_123 ; top09 grectec; 30 ,55, 60, base_123 ; top09 grectec; 10 ,53, 60, base_123 ; top09 grectec; 50 ,57, 60, base_123 ; top09 ... ... another file B.txt containing test... (4 Replies)
Discussion started by: Danish Shakil
4 Replies

3. UNIX for Dummies Questions & Answers

Re-Mapping Printers.

Hi we have a situation where some printers are on a server that sometimes has to be rebooted. If this happens the Unix boxes we have that are referencing the printers in the vfstab file fail to work even when the print server is brought back up. Does anyone know if it would be possible to put... (0 Replies)
Discussion started by: Hadleyshope
0 Replies

4. Shell Programming and Scripting

Need Help Mapping Arrays

I have the following arrays with different lengths that I want to map them with the same key. # Week numbers, 8 columns @headers = ("2011-34", "2011-35", "2011-36", "2011-37", "2011-38", "2011-39", "2011-40", "2011-41"); %data = ("2011-34", BCE, "2011-35", YZA, "2011-36",... (5 Replies)
Discussion started by: tqlam
5 Replies

5. Shell Programming and Scripting

searching a file with a specified text without using conventional file searching commands

without using conventional file searching commands like find etc, is it possible to locate a file if i just know that the file that i'm searching for contains a particular text like "Hello world" or something? (5 Replies)
Discussion started by: arindamlive
5 Replies

6. Shell Programming and Scripting

Creating unique mapping from multiple mapping

Hello, I do not know if this is the right title to use. I have a large dictionary database which has the following structure: where a b c d e are in English and p q r s t are in a target language., the two separated by the delimiter =. What I am looking for is a perl script which will take... (5 Replies)
Discussion started by: gimley
5 Replies

7. Red Hat

drive mapping

What is the eqiuvalent of /dev/dsk/rdsk in linux vs Solaris (1 Reply)
Discussion started by: walnutpony123
1 Replies

8. Homework & Coursework Questions

Mount and Mapping are same???

Please let me know if mounted on in Unix and Mapping in Windows are same thing??? (1 Reply)
Discussion started by: MZC
1 Replies

9. UNIX for Dummies Questions & Answers

Mapping drive

please forgive me. i know this is unix forum. CIFS can map to shared windows folder. i just wonder if windows can map to unix shared folder. if yes, please enlight me... (5 Replies)
Discussion started by: lawsongeek
5 Replies

10. Shell Programming and Scripting

Many to many -- mapping

INPUT 13333--TEXT1 14444--TEXT2 13333--TEXT3 12233--TEXT5 14444--TEXT5 12233--TEXT1 12222--TEXT5 13333--TEXT09 what I'm looking for is something using awk arrays with below given output. 14444--TEXT2,TEXT5 13333--TEXT1,TEXT3,TEXT09 12233--TEXT5,TEXT1 12222--TEXT5 (6 Replies)
Discussion started by: busyboy
6 Replies
PG_FIELD_TABLE(3)														 PG_FIELD_TABLE(3)

pg_field_table - Returns the name or oid of the tables field

SYNOPSIS
mixed pg_field_table (resource $result, int $field_number, [bool $oid_only = false]) DESCRIPTION
pg_field_table(3) returns the name of the table that field belongs to, or the table's oid if $oid_only is TRUE. PARAMETERS
o $result - PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others). o $field_number - Field number, starting from 0. o $oid_only - By default the tables name that field belongs to is returned but if $oid_only is set to TRUE, then the oid will instead be returned. RETURN VALUES
On success either the fields table name or oid. Or, FALSE on failure. EXAMPLES
Example #1 Getting table information about a field <?php $dbconn = pg_connect("dbname=publisher") or die("Could not connect"); $res = pg_query($dbconn, "SELECT bar FROM foo"); echo pg_field_table($res, 0); echo pg_field_table($res, 0, true); $res = pg_query($dbconn, "SELECT version()"); var_dump(pg_field_table($res, 0)); ?> The above example will output something similar to: foo 14379580 bool(false) NOTES
Note Returning the oid is much faster than returning the table name because fetching the table name requires a query to the database system table. SEE ALSO
pg_field_name(3), pg_field_type(3). PHP Documentation Group PG_FIELD_TABLE(3)
All times are GMT -4. The time now is 06:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy