![]() |
|
|
|
|
|||||||
| 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 |
| problem while making ftp of a large file | rprajendran | UNIX for Dummies Questions & Answers | 1 | 05-27-2008 10:19 PM |
| making an iso file... | asafronit | SCO | 5 | 03-08-2008 02:18 PM |
| Permanent file deletion - sensitive data | peteroc | UNIX for Advanced & Expert Users | 5 | 06-20-2007 09:10 AM |
| Making Changes without opening file | irehman | Shell Programming and Scripting | 9 | 03-16-2006 06:13 AM |
| sed : Making changes in the same file | amol | Shell Programming and Scripting | 3 | 07-17-2002 03:50 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi Friends.
I have a file called install.data which has fields like : XXXXX ACVCGFFTFY UAHIUH OI CONNECTION=tape/11/ LOCATAION=08-90-89 SIZE=90 I had to change the values of some of these variables. So i did : grep "SIZE" instal.data | sed 's/[0-9]*/00/' ...this is working fine on command line but i want to make this change permanent in the file without redirecting it to other file .I dont want to make the changes in the Vi editor . I need to use some command . Can you help in this ??? Thanks, Vijayaa |
| Forum Sponsor | ||
|
|
|
|||
|
Hi,
This is a sample script incase you need to run on single or multiple files in a directory. Code:
#!/bin/ksh
for file in *.txt ; do
sed 's/SIZE=[0-9][0-9]*/SIZE=00/g' $file > /tmp/${file}.new;
mv ${file} ${file}.old #Taking a backup before overwriting
mv /tmp/${file}.new $file;
done
Nagarajan Ganesan. |
| Thread Tools | |
| Display Modes | |
|
|