String issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting String issue
# 8  
Old 07-04-2013
Hi,

Thank you all for your time and for suggestions provided.

Requirement:
1. I have configuration file which I need to read and parse the required data dynamically.

2. Conf file may contains the dir name. suppose we have a dir called "rc3.d" and it will having some value.


in this case How to handle the "." and evaluate it.

Sorry If I am asking repeated question.
# 9  
Old 07-04-2013
Quote:
Originally Posted by munna_dude
Hi,

Thank you all for your time and for suggestions provided.

Requirement:
1. I have configuration file which I need to read and parse the required data dynamically.

2. Conf file may contains the dir name. suppose we have a dir called "rc3.d" and it will having some value.


in this case How to handle the "." and evaluate it.

Sorry If I am asking repeated question.
File names and variable names are completely different namespaces. There is no problem having one or more periods in a filename.

However, I don't understand what you want. We don't usually talk about directories having values; directories contain files. Are the filenames of the files in your directory the value you want to "handle" or "evaluate"?
# 10  
Old 07-04-2013
Quote:
Originally Posted by Don Cragun
File names and variable names are completely different namespaces. There is no problem having one or more periods in a filename.

However, I don't understand what you want. We don't usually talk about directories having values; directories contain files. Are the filenames of the files in your directory the value you want to "handle" or "evaluate"?

Hi Don,

Sorry, I think I have not conveyed the issue properly.

I am not talking about filename which contains "."
Requirement is we have a "rc3.d" dir and it contains some value lets say 12.

Then I need to read rc3.d and its value.

Hope you understand the issue now.
# 11  
Old 07-04-2013
Quote:
Originally Posted by munna_dude
Hi Don,

Sorry, I think I have not conveyed the issue properly.

I am not talking about filename which contains "."
Requirement is we have a "rc3.d" dir and it contains some value lets say 12.

Then I need to read rc3.d and its value.

Hope you understand the issue now.
This makes absolutely no sense. If "dir" is not an abbreviation for "directory", what does it mean? If it is a directory, you need to understand that a directory is one type of file.

Please explain how you put the value 12 into the dir rc3.d???
# 12  
Old 07-04-2013
Quote:
Originally Posted by Don Cragun
This makes absolutely no sense. If "dir" is not an abbreviation for "directory", what does it mean? If it is a directory, you need to understand that a directory is one type of file.

Please explain how you put the value 12 into the dir rc3.d???

Sorry, I am bit lazy, now onwards I will use absolute name. we are talking about "rc3.d" directory.

Q: how do I get the value for this "rc3.d" variable name?

A: I have to calculate number of files and directories which is under "rc3.d", then we will put it in a file as

rc3.d=12

I have to read this file and parse. For this I have written a script which posted in my previous threads.

I can tell you one more example.

IP=10.22.150.3

how to get the correct output with the code which I am proposed in my previous posts.

Last edited by munna_dude; 07-04-2013 at 06:36 PM..
# 13  
Old 07-05-2013
Quote:
I can tell you one more example.
IP=10.22.150.3
Where is the match? I see IP not I.P
...
If you cant understand our point then try to obey to this rule:
Do never use . or / naming a variable.
Have you ever seen a variable called MY/NAME ?
What do you think the shell will substitute when its sees
$MY/NAME or even $"MY/NAME"?

Now I hope you have an idea of how to modify your variable in order to use it ( by testing the above comments you should find how easy the workaround to your issue... Not giving you the solution to get you understand what is going on and why you cant use rc.etc like that, for your own good...)

Last edited by vbe; 07-05-2013 at 05:22 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Issue in inserting null string in array

I am getting some values from a file and putting them in an array..but the null strings are not getting passed to the array. So during printing the elements ,the null string is not showing in the output. during array size calculation it is also excluding null.Please let me know how to do it. # cat... (2 Replies)
Discussion started by: millan
2 Replies

2. Shell Programming and Scripting

Issue Spliting String in Python

I have a string like below Note: I have have a single to any number of comma "," seperated string assigned to jdbc_trgt variable. I need to split jdbc_trgt using comma(,) as the delimiter. I tried the below but it fails as i dont know how can i read each split string iterately. for... (4 Replies)
Discussion started by: mohtashims
4 Replies

3. Shell Programming and Scripting

Issue deleting all lines (having a specific string) in a file

I'm trying to create a script. There are 2 files - fileA.log & fileB.log fileA.log has the below data : aaaa cccc eeee fileB.log has the below data : cjahdskjah aaaa xyz jhaskjdhas bbbb abc ajdhjkh cccc abc cjahdskjah ... (7 Replies)
Discussion started by: Pandee
7 Replies

4. Programming

Unicode String Issue

I am storing some unicode characters "лфи" in a char array. When I view(x/30s <variable name>) the values in gdb it show me something like: 0x80ac47c: "?\004>\004 " 0x80ac482: "A\0048\004;\004L\004D\004>\004=\004:\0045\004/" Why it is happening so and what are these \004 representing? (1 Reply)
Discussion started by: rupeshkp728
1 Replies

5. Shell Programming and Scripting

bash integer & string issue

Hi guys, I need for the bash code below a little bit help: cat script.sh #!/bin/bash 5_MYVALUE="test" echo "$5_MYVALUE" If I try to run the script, got follow failure: ./script.sh ./script.sh: line 4: 5_MYVALUE=test: command not found _MYVALUE My questions are how... (4 Replies)
Discussion started by: research3
4 Replies

6. Shell Programming and Scripting

Display the string issue

Hi, i ran following bdf command and found below out with space uses. prd@prd02/usr/apps/cti>bdf | grep /usr/apps /dev/vg01/lvol6 17379328 9873783 7036696 58% /usr/apps /dev/vg01/SYBASE 1228800 978631 234597 81% /usr/apps/sybase 2150400 1108516 976776 ... (3 Replies)
Discussion started by: koti_rama
3 Replies

7. Shell Programming and Scripting

Issue with String Comparison (if)

Hi, I was trying to do a string comparison using if. However, the comparison result is getting treated as a executable statement. I'm not sure where I'm making the mistake! $ typeset TEST_VAR='YUP' $ if ; then echo 'Got It!'; fi; ksh: : not found. Any help is appreciated! (3 Replies)
Discussion started by: waterdrop
3 Replies

8. Shell Programming and Scripting

bash version or string issue

Hi all, I'm not sure but I guess, that is a bash version issue. The script working fine on "GNU bash, version 3.2.25(1)-release Ubuntu". #!/bin/bash while IFS=">" read a id val do if ] then VAL=${id%<*}; ID=${id#*</} echo $VAL echo $ID sed... (5 Replies)
Discussion started by: research3
5 Replies

9. Shell Programming and Scripting

string manipulation issue

I have myMethod that gives me available,used,free disk space in KB. I parse the used disk space using awk. That gives me something like 830,016. I want the output to be 830016 so that I can add 100000 to it. In other words I would like to use used_space variable in numeric calculations (using... (5 Replies)
Discussion started by: illcar
5 Replies

10. Shell Programming and Scripting

String concatenation issue in ksh

Hello All, I'm tryying to concatenate string and variables value in ksh, but i'm unable to do it, can someone please help in rectifying my error, here is the code i have written, #!/usr/bin/ksh -x cat $1 | while read fileline do val1= echo $fileline | awk -F, '{print $1}' val2= echo... (3 Replies)
Discussion started by: arvindcgi
3 Replies
Login or Register to Ask a Question