Sponsored Content
Top Forums Shell Programming and Scripting Unable to update the string in a file trough case command Post 302911826 by Chubler_XL on Sunday 3rd of August 2014 09:35:22 PM
Old 08-03-2014
grep doesn't need cat to read files, it can open them it's self. No need for perl or awk, sed can find and replace text.

Try this updated script:

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=`grep ^ws.rsp.url= properties`
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=`sed -n '/^ws.rsp.url=/s/^[^-]*-\([^.]*\)\..*/\1/p' properties`
       echo $rsp
       echo $env
       sed "/^ws.rsp.url/s:$rsp:$env:" properties > /tmp/properties.$$
       mv /tmp/properties.$$ properties
       LINE12=`grep ^ws.rsp.url properties`
       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"

 

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
STG-PUSH(1)							   StGit Manual 						       STG-PUSH(1)

NAME
stg-push - Push one or more patches onto the stack SYNOPSIS
stg push [options] [<patch1>] [<patch2>] [<patch3>..<patch4>] DESCRIPTION
Push one or more patches (defaulting to the first unapplied one) onto the stack. The push operation allows patch reordering by commuting them with the three-way merge algorithm. If there are conflicts while pushing a patch, those conflicts are written to the work tree, and the command halts. Conflicts raised during the push operation have to be fixed and the git add --update command run (alternatively, you may undo the conflicting push with stg undo). The command also notifies when the patch becomes empty (fully merged upstream) or is modified (three-way merged) by the push operation. OPTIONS
-a, --all Push all the unapplied patches. -n NUMBER, --number NUMBER Push the specified number of patches. --reverse Push the patches in reverse order. --set-tree Push the patches, but don't perform a merge. Instead, the resulting tree will be identical to the tree that the patch previously created. This can be useful when splitting a patch by first popping the patch and creating a new patch with some of the changes. Pushing the original patch with --set-tree will avoid conflicts and only the remaining changes will be in the patch. -k, --keep Keep the local changes. -m, --merged Check for patches merged upstream. STGIT
Part of the StGit suite - see linkman:stg[1] StGit 03/13/2012 STG-PUSH(1)
All times are GMT -4. The time now is 10:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy