03-12-2012
Picking contents value of file at run time based on variable values
HI,
I have to write a unix script and need your help.
in my application where I have to invoke this script a varialble is there where the value comes in a variable . for example variable can be var=ABC
like this there will be any type of value in the vcariable.
there is a unix directory structure where
/home/source/files/
this directory has files like
abc.txt and content of file are
source_directory=/home/abc/source/
target_directory=/home/abc/target/
temp_directory=/home/abc/temp/
arch_directory=/home/abc/archive/
I have to fecth the value of source_directory, target_directory,temp_directory, arch_directory at run time and use this value for further processing.
if Value of variable will be xxx and the file name will be xxx.txt from where values will be picked and values available in file will be
xxx.txt and content of file are
source_directory=/home/xxx/source/
target_directory=/home/xxx/target/
temp_directory=/home/xxx/temp/
arch_directory=/home/xxx/archive/
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear frnds
My requirement is as follows
-rw-r----- 1 f02 dd 109428250 May 18 14:02 Extracts_20070518104730.zip
-rw-r----- 1 f02 dd 109493187 May 21 13:30 Extracts_20070521091700.zip
-rw-r----- 1 f02 dd 109993058 May 23 14:14 Extracts_20070523085955.zip
-rw-r----- 1... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies
2. UNIX for Dummies Questions & Answers
Hello,
I have two files as shown below:
test1
678
679
689
690
710
test2
1 678
654 800
676 791
689 900
I want to get a count of lines from test2 whose columns bound the values in test1
I tried running the code below; however am getting wrong results. (3 Replies)
Discussion started by: Gussifinknottle
3 Replies
3. Shell Programming and Scripting
Hi Friends,
Newbie to shell scripting. Currently i have used the below to sort data based on filenames and datestamp
$ printf '%s\n' *.dat* | sort -t. -k3,4
filename_1.dat.20120430.Z
filename_2.dat.20120430.Z
filename_3.dat.20120430.Z
filename_1.dat.20120501.Z
filename_2.dat.20120501.Z... (1 Reply)
Discussion started by: robertbrown624
1 Replies
4. UNIX for Dummies Questions & Answers
Hi Friends,
Newbie to shell scripting
Currently i have used the below to sort data based on filenames and datestamp
$ printf '%s\n' *.dat* | sort -t. -k3,4
filename_1.dat.20120430.Z
filename_2.dat.20120430.Z
filename_3.dat.20120430.Z
filename_1.dat.20120501.Z
filename_2.dat.20120501.Z... (12 Replies)
Discussion started by: robertbrown624
12 Replies
5. Shell Programming and Scripting
Hi,
I have a file which contains values in this format.
abc
cde
fgh
ijk
lmn
opq
rst
uvw
The user will pass the required parameter from the command line.
My requirement is that script should pick the values passed by the user and the next value in the next line.
Like if the user... (10 Replies)
Discussion started by: arijitsaha
10 Replies
6. Shell Programming and Scripting
Hi,
Below is starting entry of my script
#!/bin/ksh
Usage()
{
print "Usage: $0 ID OPTION SERVER"
print "<br>Where :"
print "<br>Enter your ID into PARAM1, OPTION in the PARAM2 and SERVER in the PARAM3 field"
print "<br>ID should be a valid ID"
print "<br>OPTION should be either... (2 Replies)
Discussion started by: gopajitmalakar
2 Replies
7. Shell Programming and Scripting
Hello Expert,
I need to transpose Date-Timestamp based on same column values and calculate time difference. The input file would be as below and required output is mentioned in the bottom
INPUT File
========
08/23/2012 12:36:09 JOB_5340
08/23/2012 12:36:14 JOB_5340
08/23/2012... (2 Replies)
Discussion started by: asnandhakumar
2 Replies
8. Programming
Hi
I trying to write a python script that executes a command to screen scrub results below
I will appreciate it very much if you can help me with a python script that can
pick the percentage USAGE in the second column based on the supplied queue number in the first column
Thanks in advance.
... (2 Replies)
Discussion started by: kaf3773
2 Replies
9. Shell Programming and Scripting
Hi one of the output of the command is as below
# sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/'
Resource List : <br>
*************************** 1. row ***************************<br>
... (2 Replies)
Discussion started by: vivek d r
2 Replies
10. Shell Programming and Scripting
Hi ,
I did the initial search but could not find what I was expecting for.
15606Always_9999999997_20160418.xml
15606Always_9999999998_20160418.xml
15606Always_9999999999_20160418.xml
9819Always_99999999900_20160418.xml
9819Always_99999999911_20160418.xmlAbove is the list of files I... (4 Replies)
Discussion started by: chillblue
4 Replies