How do I change the values in a file?

TRASH_PATH:~/deleted/
MAX_VERSIONS:5
FILE_MAX_SIZE:1024
FOLDER_MAX_SIZE:8096
TRASH_MAX_SIZE:1024
LOG_MAX_SIZE:100

how do i change the value of TRASH_MAX_SIZE to 2040 using the script?
the filename is config.ini
please advice

sed -i "s/TRASH_MAX_SIZE:1024/TRASH_MAX_SIZE:2040/" config.ini
1 Like

if you don't have the -i option on sed use PERL code below:

perl  -i -wlpe 's/TRASH_MAX_SIZE:1024/TRASH_MAX_SIZE:2040/;' config.ini

:b::b:

1 Like

Thanks that helped. :slight_smile:

Hi Amman,

I dont use perl single liners at all. Could you tell me what the -i and the -w1pe options are??

Here you will find descriptions of all the options: perlrun - how to execute the Perl interpreter - Perldoc Browser
BTW, its "l" (lower case "L"), not "1".