how to modify existing env var


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to modify existing env var
# 1  
Old 08-10-2012
how to modify existing env var

greetings,

i have the following env variable:

Code:
LSB_HOSTS='t70cra102 t70cra102 t70cra108 t70cra108'

the variable could be any number of host names and sometimes the same name several times. i was hoping there's a way to turn it into the following:

Code:
NEW_LSB_HOSTS=[["t70cra102",1],["t70cra102",1],["t70cra108",1],["t70cra108",1]]

always appreciate the help and support here, regards, joe.
# 2  
Old 08-10-2012
Try:
Code:
NEW_LSB_HOSTS=$(echo "$LSB_HOSTS" | sed 's/\(.*\)/[["\1",1]]/;s/ /",1],["/g')

This User Gave Thanks to bartus11 For This Post:
# 3  
Old 08-10-2012
OUTSTANDING!

thanx so much bartus11
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

BASH script to export var to env

Hi all I am trying to create a script that takes a password input then writes that to a tmp file and puts that tmp file path in my env as a var. It does everything but export the my env and I am unsure why. I am using Ubuntu 12.4 #!/bin/bash read -s -p "Enter Password: " gfpassword... (5 Replies)
Discussion started by: koikoi
5 Replies

2. Shell Programming and Scripting

Modify existing values in a file

Hi, I am trying to write a shell script which will modify existing values and take backup of old values. file trying to modify is : /etc/sysctl.conf script name: modify.sh execute ./modify.sh enter ref no: 123 add below values in file sysctl.cnf kernel.shmall = 4194304 ... (7 Replies)
Discussion started by: darling
7 Replies

3. Shell Programming and Scripting

Need to implement new CRON job or modify the existing one in MDM PROD in coming days, which will sen

Need to implement new CRON job or modify the existing one in MDM PROD in coming days, which will send email of SQL statement running from past 1 minute.Currently there is one CRON job in PROD, which send below email. there is one cron job which send email, when there is long running... (0 Replies)
Discussion started by: dampu
0 Replies

4. Web Development

Deny from env=env-variable Does not work

(Above from Apache docs). On my system, using: SetEnvIf User-Agent Mozilla IsBad=1 Order allow,deny Allow from all Deny from env=IsBad ...I see that environment variable is set (using phpinfo()) but the page is still served. No errors in the Apache logs. (1 Reply)
Discussion started by: gnurob
1 Replies

5. Solaris

Modify /var/run.

Hello, I want to modify the /var/run fs from 86G to say 2G. How to go about it? Thanks. swap 64G 38K 64G 1% /var/run Regards. Edit/Delete Message (6 Replies)
Discussion started by: mahive
6 Replies

6. Shell Programming and Scripting

modify Existing MS excel workbook in perl

Hi I need to modify an excel file in perl and for which I installed perl in Linux 1. Open a existing excel file 2. delete an unwanted Sheet called "summary" 3. and i want to insert some data into range of cells ( B1:B11) 4. Remove unwanted value called "Sum" repeated in the... (1 Reply)
Discussion started by: luke_devon
1 Replies

7. Shell Programming and Scripting

insert pipes for existing and non-existing records

I have a source file like this, L4058S462 34329094 F51010141TK1070000483L4058S462 34329094 0232384840 381892 182 5690 L4058S462 34329094 F51020141FIRST CLEARING, LLC A/C 3432-9094 L4058S462 34329094 F51030141JOHAN HOLMQVIST ... (1 Reply)
Discussion started by: saravanamr
1 Replies

8. UNIX for Advanced & Expert Users

How to modify an existing pdf with unix shell commands

Hi, I know that to create a pdf file I can use the txt2pdf command. But if I would change an existing pdf file, by inserting lines in particular positions of this file, what can I use? And How? (3 Replies)
Discussion started by: fandwick
3 Replies

9. Shell Programming and Scripting

Adding command line env in cron env

Hello friends, i run two scripts manually & they work. i run them in cron & they don work. how to match the two env's 1.command line env 2.cron env i would like cron to use command line env. Thanks & Regards Abhijeet (1 Reply)
Discussion started by: abhijeetkul
1 Replies
Login or Register to Ask a Question