Sponsored Content
Top Forums Shell Programming and Scripting Unable to update the string in a file trough case command Post 302911655 by bhas85 on Saturday 2nd of August 2014 07:45:34 AM
Old 08-02-2014
Unable to update the string in a file trough case command

Hi All,

my requirement is first search the line and updated stg value with the user input value.
Code:
ws.rsp.url=https://rt930.rsp-stg.cb.info53.com/RSP/RAFT^M

stg is not fixed string it may varies.So i used the below command for it
Code:
rsp=`cat properties | grep ^ws.rsp.url= | awk -F"/" '{print $3}' | awk -F"-" '{print $2}'|awk -F"." '{print $1}'`

when i use the below command through command line it's working fine.But when use in code it's not working.
Code:
"cat properties | grep ^ws.rsp.url | perl -pi -e 's/stg/$dev/' properties"

My code:
Code:
select env in  dev stg qa
do
if [ $env != "" ]; then
      echo "SELECTED ENVIRONMENT IS : $env"
      break
   else
      echo "Illegal selection."
fi
done
echo " "
Line3=`cat properties | grep ^ws.rsp.url=`
echo "Current rsp url is as follow.Please make selection carefully"
echo $Line3
echo " "
echo "Would you like to add any "stg dev qa " tip to point rsp url (y/n)?"
read yn
    case $yn in
        [Yy]* )
    rsp=`cat properties | grep ^ws.rsp.url= | awk -F"/" '{print $3}' | awk -F"-" '{print $2}'|awk -F"." '{print $1}'`
    echo $rsp
    echo $env
    cat properties | grep ^ws.rsp.url | perl -pi -e 's/${rsp}/${env}/' properties
    LINE12=`cat properties | grep ^ws.rsp.url`
     echo "changed rsp url as below"
      echo $LINE12;;
        [Nn]* )
        echo "As per you selection it's not required to change rsp url"
         ;;
        * )
    esac
echo " rsp url is ready now"

file is too large so mentioned only the line of the file need to be updated
---------
Code:
ws.clairMail=https;//
rewards=https;//
ws.rsp.url=https://rt930.rsp-stg.cb.info53.com/RSP/RAFT^M

Please let me know if you need some moredetails about my requirement.I am using AIX.
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

lower case to upper case string conversion in shell script

How can convert a Lower case variable value to an upper case in the kron shell script. (3 Replies)
Discussion started by: dchalavadi
3 Replies

2. Solaris

Unable to update the Crontab

Hi Everyone, Each time I do update the crontab, it gets reset after exiting from the telnet session. I'm using Solaris 2.8 So it goes like this: Step 1: Login as root, from a telnet session Step 2: Crontab -e (I make modification) Step 3: Save and exit Step 4: Type crontab -l , changes... (4 Replies)
Discussion started by: Jeremy3
4 Replies

3. UNIX for Dummies Questions & Answers

update file command help

please explain this update to the webcache.xml file ( attached) sorry i come from a windows env thank you ************* echo -n "7. Updating webcache.xml file..." set line_num = `grep -n "</CACHEABILITY>" $ORACLE_HOME/webcache/webcache.xml | tail -1 | cut -d : -f 1` head -`expr $line_num... (0 Replies)
Discussion started by: maoro
0 Replies

4. Shell Programming and Scripting

convert file names to upper case using tr command in Unix

Hi All, Need to convert file names to upper case using tr command in Unix. In a folder -> /apps/dd01/misc there are two files like: pi-abcd.pdf pi-efgh.pdf The output of should be like: pi-ABCD.pdf pi-EFGH.pdf I have used the command to work for a single file at a time... (3 Replies)
Discussion started by: a1_win
3 Replies

5. UNIX for Dummies Questions & Answers

UNABLE TO UPDATE! HELP!

I just installed the latest version of ubuntu and I can't run the update manager without getting an error message. Im not sure what info i need to post so i can get help so just tell me if i need to post info because i would like to use ubuntu. (2 Replies)
Discussion started by: Brandyn
2 Replies

6. Shell Programming and Scripting

Test command non case specific string comparision

Hi, I want to do caseless string comparision using test command for eg: Ind_f="y" test "$Ind_f" == "y|Y" i tried , ** , nothing worked. any thoughts on how to do case insensitive string comparison using test command without converting to any particular case using typeset or tr? (8 Replies)
Discussion started by: Kulasekar
8 Replies

7. Shell Programming and Scripting

Unable to attach a .txt file or .log file to mail and mailx command

Hi, I am trying to attach a .log file or .txt file to mail command to send an email once my ksh script executed. I am unable to use mutt command as it has been not installed and i am not supposed to install it. I have tried many ways by googling which has not helped me to succeed. Here is my... (5 Replies)
Discussion started by: Samah
5 Replies
QRENCODE(1)						      General Commands Manual						       QRENCODE(1)

NAME
qrencode - Encode input data in a QR Code and save as a PNG or EPS image. SYNOPSIS
qrencode [OPTION]... [STRING] DESCRIPTION
Libqrencode is a library for encoding data in a QR Code symbol, a kind of 2D symbology that can be scanned by handy terminals such as a mobile phone with CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness. Qrencode is a utility software using libqrencode to encode string data in a QR Code and save as a PNG or EPS image. OPTIONS
-h, --help display help message. -o FILENAME, --output=FILENAME write image to FILENAME. If '-' is specified, the result will be output to standard output. If -S is given, structured symbols are written to FILENAME-01.png, FILENAME-02.png, ... (suffix is removed from FILENAME, if specified) -s NUMBER, --size=NUMBER specify the size of dot (pixel). (default=3) -l {LMQH}, --level={LMQH} specify error collectin level from L (lowest) to H (highest). (default=L) -v NUMBER, --symversion=NUMBER specify the version of the symbol. (default=auto) -m NUMBER, --margin=NUMBER specify the width of margin. (default=4) -d NUMBER, --dpi=NUMBER specify the DPI of the generated PNG. (default=72) -t {PNG,EPS,ANSI,ANSI256}, --type={PNG,EPS,ANSI,ANSI256} specify the type of the generated image. (default=PNG) -S, --structured make structured symbols. Version must be specified. -k, --kanji assume that the input text contains kanji (shift-jis). -c, --casesensitive encode lower-case alphabet characters in 8-bit mode. (default) -i, --ignorecase ignore case distinctions and use only upper-case characters. -8, --8bit encode entire data in 8-bit mode. -k, -c and -i will be ignored. -M, --micro encode in a Micro QR Code. (experimental) -V, --version display the version number and copyrights of the qrencode. [STRING] input data. If it is not specified, data will be taken from standard input. EXAMPLES
qrencode -l L -v 1 -o output.png 'Hello, world!' encode into a symbol version 1, level L. qrencode -iSv 1 --output=output.png read standard input and encode it into a structured-appended symbols in case-insensitive mode. AUTHOR
Written by Kentaro Fukuchi. RESOURCES
Main Web Site: http://fukuchi.org/works/qrencode/ Source code repository: https://github.com/fukuchi/libqrencode/ COPYRIGHT
Copyright (C) 2006-2012 Kentaro Fukuchi. qrencode 3.3.0 Feb. 29, 2012 QRENCODE(1)
All times are GMT -4. The time now is 09:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy