![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| the best way of editing .plist files | mehow | OS X (Apple) | 1 | 01-21-2008 02:46 PM |
| Editing files | sameersbn | UNIX for Dummies Questions & Answers | 2 | 01-19-2007 01:22 PM |
| Linux game programing or just shell scripting | Irish Jimmy | Linux | 3 | 09-02-2006 12:11 AM |
| mutex in shell programing | zz_xm | Shell Programming and Scripting | 1 | 03-09-2005 06:53 PM |
| editing unix files on NT | pixelmonkey | UNIX for Dummies Questions & Answers | 1 | 02-01-2001 08:44 AM |
|
|
Submit Tools | LinkBack | Thread Tools | 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 . 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 |
|||
| Google The UNIX and Linux Forums |
| Forum Sponsor | ||
|
|