need help in concatenating


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need help in concatenating
# 1  
Old 02-21-2011
need help in concatenating

Hi All ,

i`m writing a script , i stucked in middle .

Script
Code:
echo "Please Enter the INSTANCE name"
read iName 
echo "The INSTANCE name is $iName"
 
more /opt/IBMIHS*/conf/httpd.conf_"$iName"

script end

here i`m getting error as :

Error
Code:
/opt/IBMIHS*/conf/httpd.conf_w101: not found


actually wen i`m doing it manually more is working but in script its not coming.



can any one explain me the reason why its not coming and how can i avoid that error??

thx in adv

Last edited by pludi; 02-21-2011 at 04:42 AM..
# 2  
Old 02-21-2011
Check for both the environment and shell (in script and manual).
May be you have "globbing" off?

Code:
$ set -o noglob
$ ls *
* not found
$ set +o noglob
$ ls *
1                            a.u                          d                            i

# 3  
Old 02-21-2011
can u put how you are manually doing via more, just ensure to find was there any typo
# 4  
Old 02-21-2011
You should also separate the variable name from the string with curly braces..
Code:
more /opt/IBMIHS*/conf/httpd.conf_"${iName}"

# 5  
Old 02-21-2011
@michael

u rockzz man.. it working very well..

thanks a lot

thanks for the site also...

---------- Post updated at 05:49 PM ---------- Previous update was at 05:43 PM ----------

hey guys,

sry the prob is not resolved

i`m giving a part of my script

Code:
echo "Please Enter the INSTANCE name"
read iName
echo "The INSTANCE name is $iName";
Sname=`hostname`;
cat /opt/IBMIHS*/conf/httpd.conf_"${iName}"

Code:
Error:
cat: /opt/IBMIHS*/conf/httpd.conf_wl03a: No such file or directory

wen i`m trying manually ,

supposed o/p :
Code:
$ cat httpd.conf_wl03
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.
$ pwd
/opt/IBMIHS/conf
$

thanks in adv


Moderator's Comments:
Mod Comment Please use [code] and [/code] tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks.

Last edited by zaxxon; 02-21-2011 at 08:29 AM.. Reason: code tags
# 6  
Old 02-21-2011
Can't see the a in your source file...
# 7  
Old 02-21-2011
@above ,

hey i checked nw , its der.. mi8 b i missed to update that . "a" is der also




@mod , gng fwd i`ll follow that format
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Concatenating Output

Hello all The following line : df -h | awk '{print $5}'| head -2 |tail -1 gives me an output of '2.2G' How can I remove the 'G' so that I can use the 2.2 for further calculations ? (8 Replies)
Discussion started by: Junaid Subhani
8 Replies

2. UNIX for Dummies Questions & Answers

Concatenating columns

Hi I have the following input file, It is a tab delimited file ISOCOUNTRYCODE POSTALCODE CITY HNO STREETBASENAME STREETTYPE FIN 40950 Muurame Teollisuus tie FIN 02160 Westendintie FIN 33210 Tampere Päämäärän kuja... (2 Replies)
Discussion started by: ramky79
2 Replies

3. UNIX for Dummies Questions & Answers

Concatenating

Hi, I have file called "3rdparty.dat" I want to concatenate current YYYYMMDD to it. Snd result should be like 3rdParty20111110.dat. How can i do this? Thanks in advance. (3 Replies)
Discussion started by: raj.shah.0609
3 Replies

4. Shell Programming and Scripting

de concatenating a string

I have a variable var=string1:string2:string3 I want to get the string de-concatenated and put it as var1=string1 var2=string2 var3=string3 Thanks in advance. ---------- Post updated at 02:18 PM ---------- Previous update was at 01:45 PM ---------- I got the solution as below:... (2 Replies)
Discussion started by: Deepak62828r
2 Replies

5. Red Hat

Concatenating variables

Hi all, I'm trying to do a very simple script, as you can see as follow: #!/bin/bash #Valorizzazione Token presenti nel file di properties var_path_weblogic="`cat weblogic.properties | grep "dir_wl" | /usr/xpg4/bin/awk '{print $3}'`" var_ip_address="`cat... (5 Replies)
Discussion started by: idro
5 Replies

6. Shell Programming and Scripting

Concatenating two line into one

Hi, I have a scenario where I have a data file something like this below: SH1,QC,12334 RD1,MO,898909,35476 SH1,BC,34556 RD1,FG,2341212,909090 SH1,TR,787878 RD1,GH,12345,676767 SH1,YO,565656 RD1,GO,7878604,23978 All I have to do is to concatenate the record starting with SH1... (9 Replies)
Discussion started by: simi28
9 Replies

7. Shell Programming and Scripting

concatenating strings

I m new to shell scripting and what i want is take as an i/p from command line the name of the file and inside my script i should redirect the o/p of my few commands to this file concatenated with .txt for example if i give ./linux filename i should get the o/p in filename.txt i need to... (2 Replies)
Discussion started by: tulip
2 Replies

8. Shell Programming and Scripting

Concatenating two files

HI I need to concatenate two files which are having headers. the result file should contain only the header from first file only and the header in second file have to be skipped. file1: name age sriram 23 file2 name age prabu 25 result file should be name age sriram 23 prabu ... (6 Replies)
Discussion started by: Sriramprabu
6 Replies

9. Shell Programming and Scripting

Concatenating Different # of Variables

Hi, I'm quite new at unix and was wondering if anyone could help me with this. I have 2 arrays: eg. STAT=online, STAT=offline, STAT=online WWN=xxxx1, WWN=xxxx2, WWN=xxxx3 I got these information from a script using fcinfo hba-port that runs through a loop. Now, I want to store... (2 Replies)
Discussion started by: jake_won
2 Replies

10. Shell Programming and Scripting

Concatenating Variables

FILE_DATE=$(date +"%Y%m%d_%H%M")_ FILE_PREFIX=${FILE_DATE} echo $FILE_PREFIX JS_LOG_DIR="E:\DecisionStream Jobs\Invoice Balance Fact Jobs" echo $JS_LOG_DIR --This is where the problem surfaces. The last line of this script does a rsh to an NT machine and one of the parameters is the... (2 Replies)
Discussion started by: photh
2 Replies
Login or Register to Ask a Question