Sponsored Content
Top Forums Shell Programming and Scripting I need to add something to a file, plzz help Post 302220296 by aigles on Thursday 31st of July 2008 10:43:35 AM
Old 07-31-2008
Sounds like homework...

A possible solution :
Code:
> cat asirohi.sh
InputFile='asirohi.dat'
JavaOpts='JAVA_OPTS'

if grep -q "^$JavaOpts=" $InputFile
then
   if grep -q "^$JavaOpts=\"-client " $InputFile
   then
      echo "No change neeeded !"
   else
      sed "s/^\($JavaOpts=\"\)/\1-client /" $InputFile > ${InputFile}.tmp && \
      mv ${InputFile}     ${InputFile}.old                                && \
      mv ${InputFile}.tmp ${InputFile}
   fi
else
   echo "File doesn't contain $JavaOpts variable definition !"
fi
> cat asirohi.dat
ROOT=/
JAVA_OPTS="-Dname=$JAVA_NAME -Xmx$JVM_MAX -DAGENT_HOME=$RT_HOME -DINSTALL_DIR=$RT_HOME -Djavax.net.ssl.keyStore=$RT_HOME/conf/client
.keystore -Djavax.net.ssl.keyStoreType=jks -Djavax.net.ssl.keyStorePassword -Dhttps.cipherSuites=SSL_RSA_WITH_RC4_128_SHA $DEBUG_OPT
S -COMM_NOT_DEPLOY=native_lib $AGENT_CONFIG_PROPS"
TMP=/tmp
> asirohi.sh
> cat asirohi.dat
ROOT=/
JAVA_OPTS="-client -Dname=$JAVA_NAME -Xmx$JVM_MAX -DAGENT_HOME=$RT_HOME -DINSTALL_DIR=$RT_HOME -Djavax.net.ssl.keyStore=$RT_HOME/con
f/client.keystore -Djavax.net.ssl.keyStoreType=jks -Djavax.net.ssl.keyStorePassword -Dhttps.cipherSuites=SSL_RSA_WITH_RC4_128_SHA $D
EBUG_OPTS -COMM_NOT_DEPLOY=native_lib $AGENT_CONFIG_PROPS"
TMP=/tmp
> asirohi.sh
No change neeeded !
> cat asirohi.dat
ROOT=/
JAVA_OPTS="-client -Dname=$JAVA_NAME -Xmx$JVM_MAX -DAGENT_HOME=$RT_HOME -DINSTALL_DIR=$RT_HOME -Djavax.net.ssl.keyStore=$RT_HOME/con
f/client.keystore -Djavax.net.ssl.keyStoreType=jks -Djavax.net.ssl.keyStorePassword -Dhttps.cipherSuites=SSL_RSA_WITH_RC4_128_SHA $D
EBUG_OPTS -COMM_NOT_DEPLOY=native_lib $AGENT_CONFIG_PROPS"
TMP=/tmp
~/Forums>

Jean-Pierre.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

problem with GREP, help plzz

I just want the output of this command to be stored in a variable like, str = `grep Application.dbName serverdata/ServerProp.txt` but while executing it says like, str : startup 11: not found, where startup is the script name. but while running the command alone like, grep... (2 Replies)
Discussion started by: cs_sakthi
2 Replies

2. Shell Programming and Scripting

shell script & sqlplus "plzz help"

hi friends, i m tryin to load data from one set of table to other i have sql procedure al ready for it..! i m going to load the procedure only if data in one of my table for example table "landing " have 10 records each attribute of this table is file_name status date ... (2 Replies)
Discussion started by: kulbir
2 Replies

3. Shell Programming and Scripting

how to create file.txt and add current date in file content

Hey guy, how to make bash script to create foo.txt file and add current date into file content and that file always append. example: today the script run and add today date into content foo.txt and tomorrow the script will run and add tomorrow date in content foo.txt without remove today... (3 Replies)
Discussion started by: chenboly
3 Replies

4. Shell Programming and Scripting

Not able to solve these questions plzz help

1.Display a list of /usr/share/doc subdirectories containing information about shells.How many README files do these subdirectories contain? Don't count anything in the form of "README.a_string". 2.Make a list of files in your home directory that were changed less that 10 hours ago, using grep,... (2 Replies)
Discussion started by: cynosure2009
2 Replies

5. Shell Programming and Scripting

Shell Script..plzz help

Hi all, if any body could help me out to automate the unix script for finding some particualar files which are based on dates like see every day i need check the TXT files which are being in processed and Sequential order based on dates For Example: files name starts at... (12 Replies)
Discussion started by: krux_rap
12 Replies

6. Shell Programming and Scripting

Strange errors with shell scripts..plzz help

Hi all... Please help me with this questions. I am not good at shell scripting. 1) It seems like there are many ways that we can run the shell scripts. what is the difference between each one? i)./shell_script.sh ii).(space)./ shell_script.sh iii)sh shell_script.sh ... (3 Replies)
Discussion started by: sanskumar2003
3 Replies

7. Homework & Coursework Questions

need help with a shel script plzz

hey how u doing guys ... I'm a student @ EMU and taking a beginner Linux class and I have those two extra credit project that im struggling with so I hope to get some correction and help write a shell script that will 1-prompt the user for a file name 2-check to see if the file exists... (2 Replies)
Discussion started by: flyman
2 Replies

8. Shell Programming and Scripting

Modify a file by another file: add new line and variable after string is found

hello, I have problem with writing/adjusting a shell script. I searched forum and unfortunately couldn't write scipt based on the information I found. I never wtire such so it's hard for me and I do need to modify one script immediately. case looks like: 1. 'file' that needs to be modified... (3 Replies)
Discussion started by: bipbip
3 Replies

9. UNIX for Beginners Questions & Answers

How do I add a log file path to a vi file to monitor all the changes made to the file?

I'm curious to know how do I add an empty log file (test1.log) to an existing text file to monitor all the changes made to a.txt. Is this expression export PATH=$PATH:/home/test1.log right to be added to the text file a.txt? (5 Replies)
Discussion started by: TestKing
5 Replies
JOSM(1) 						      General Commands Manual							   JOSM(1)

NAME
josm - Java OpenStreetMap Editor SYNOPSIS
josm DESCRIPTION
josm is an editor for OpenStreetMap written in Java 1.5. OpenStreetMap is a project aimed squarely at creating and providing free geographic data such as street maps to anyone who wants them. It allows you to view, edit and use geographical data in a collaborative way from anywhere on earth. The project was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, pro- ductive or unexpected ways. OPTIONS
-h, -?, --help Show help --geometry=<width>x<height>(+|-)x(+|-)y Standard X geometry argument [--download=]minlat,minlon,maxlat,maxlon Download the bounding box [--download=]<url> Download the location at the url (with lat=x&lon=y&zoom=z) [--download=]<filename> Open file (as raw gps, if .gpx) --downloadgps=minlat,minlon,maxlat,maxlon Download the bounding box as raw gps --selection=<searchstring> Select with the given search --no-fullscreen Don't launch in fullscreen mode --reset-preferences Reset the preferences to the default --language=<language> Set the language ENVIRONMENT
JAVA_HOME Specify an alternate Java environment. JAVA_OPTS Specify Java options. For example, to use a HTTP proxy server with this program, set this environment variable to something like JAVA_OPTS="-Dhttp.proxyHost=yourProxyURL" before starting josm. SEE ALSO
josm-plugins(1). AUTHOR
josm was written by Immanuel Scholz. The current maintainer is Frederik Ramm. This manual page was written by Andreas Putzo <andreas@putzo.net>, for the Debian project (but may be used by others). September 8, 2007 JOSM(1)
All times are GMT -4. The time now is 02:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy