![]() |
|
|
|
|
|||||||
| 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 |
| Change 'which' file is used | JJ07 | UNIX for Dummies Questions & Answers | 1 | 01-05-2008 09:42 AM |
| How to change the file name | rp1982 | UNIX for Dummies Questions & Answers | 2 | 11-29-2007 09:49 PM |
| Change format to file II | DebianJ | UNIX for Advanced & Expert Users | 0 | 03-07-2006 11:25 AM |
| How to change this file with SED? | bejgirl | Shell Programming and Scripting | 4 | 01-03-2006 06:23 AM |
| Help with multiple file rename - change case of part of file name | steve7 | UNIX for Dummies Questions & Answers | 7 | 06-30-2005 10:41 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
I want to make some scripts to change the System configuration automatically. My server is Redhat Enterprise 3.0, it seems I can't use -i option. But thank u in advance.
Last edited by GCTEII; 03-06-2006 at 11:50 PM. |
| Forum Sponsor | ||
|
|
|
#9
|
||||
|
||||
|
Did you try the sed command that was posted earler ?
Code:
sed -e 's/\(INI_TEST\) YES/\1 NO/g' setup.ini > setup.ini.new |
|
#10
|
|||
|
|||
|
Quote:
|
|
#11
|
||||
|
||||
|
Code:
$ cat setup.ini
INI_START YES
INI_END YES
INI_TEST YES
$ awk '$1=="INI_TEST"{$2="NO"}{a[NR]=$0}END{close(FILENAME);for(i=1;i<=NR;i++)print a[i]>FILENAME}' setup.ini
$ cat setup.ini
INI_START YES
INI_END YES
INI_TEST NO
|
|
#12
|
|||
|
|||
|
Quote:
Thank u all in advance! |
|
#13
|
||||
|
||||
|
There must be a blue moon tonight! This actually looks more readable in perl!
Code:
$ cat setup.ini
INI_START YES
INI_END YES
INI_TEST YES
$ perl -pi -e 'if ($_ =~ /^INI_START/) {s/YES/NO/}' setup.ini
$ cat setup.ini
INI_START NO
INI_END YES
INI_TEST YES
$
|
|
#14
|
|||
|
|||
|
Quote:
|
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|