hey guys,
I have a large txt file that i need to add some data to. Whats the best way of doing this from the command line?
example;
txt file to edit has a section within like this;
####_customer_data
I need to search for the above string, then under neath it add the following lines;
line one {
line two data
line three data
line four data
}
I need to be careful that the script DOESN'T overwrite any existing data.
So far I've had success with;
cat txtfile_to_edit.cfg | sed "/####_customer_data/a\
cfg_dir=$webroot/customers/$1" > txtfile_to_edit.edit.cfg
but I'm struggling to get to work over multiple lines.
Any suggestion?
Thanks in advance
I have a large txt file that i need to add some data to. Whats the best way of doing this from the command line?
example;
txt file to edit has a section within like this;
####_customer_data
I need to search for the above string, then under neath it add the following lines;
line one {
line two data
line three data
line four data
}
I need to be careful that the script DOESN'T overwrite any existing data.
So far I've had success with;
cat txtfile_to_edit.cfg | sed "/####_customer_data/a\
cfg_dir=$webroot/customers/$1" > txtfile_to_edit.edit.cfg
but I'm struggling to get to work over multiple lines.
Any suggestion?
Thanks in advance