![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| the best way of editing .plist files | mehow | OS X (Apple) | 1 | 01-21-2008 06:46 PM |
| Editing files | sameersbn | UNIX for Dummies Questions & Answers | 2 | 01-19-2007 05:22 PM |
| Linux game programing or just shell scripting | Irish Jimmy | Linux | 3 | 09-02-2006 03:11 AM |
| mutex in shell programing | zz_xm | Shell Programming and Scripting | 1 | 03-09-2005 10:53 PM |
| editing unix files on NT | pixelmonkey | UNIX for Dummies Questions & Answers | 1 | 02-01-2001 12:44 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Editing files in shell programing
Hi folks,
In our product installation program we edit xml files by deleting lines and appending new lines instead of them. For example: update_Log4plsql_xml() { machineName=`uname -n` hostIP=`cat /etc/hosts | grep ${machineName} | cut -f1` trap 'clean_up | tee -a $installLog ; exit' 1 2 3 4 15 16 echo "\nChecking log4plsql.xml ..." >> $installLog errMsg="ERROR: unable to add environmental parameter to log4plsql.xml - see error log" validMsg="-> VALID: Successfully updated log4plsql.xml" export log4plsqlxml=${orcaHome}/Log4plsql/properties/log4plsql.xml export grepXml=HOST_NAME export lineNum=`grep -n ${grepXml} ${log4plsqlxml} | awk -F: '{print $1}'` echo "#!/bin/ksh ed -s ${log4plsqlxml} <<EOF >/dev/null ${lineNum} d ${lineNum}-1 a <dburl>jdbc racle:thin:@${DB_HOST}:1521:${ORACLE_SID} /dburl>. w q EOF" > /tmp/log4plsqlED && chmod 755 /tmp/log4plsqlED && /tmp/log4plsqlED confirm_return rm /tmp/log4plsqlED } What do u think about this kind of method? Do you have any efficient alternatives to edit files? Thanks in advance, Nir |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|