Create a script that will modify a text file
I am trying to create a script that will modify a text file.
I would like help writing a script that will open a text file called ‘Event22.txt’, and change the value ‘Event 22’ to ‘Event 23’, and ‘id-22’ to ‘id=23’ then save the file as ‘Event 23’. The test looks like this: "wms_title" "Event 22" END # Get the lines from the 'location' column of the 'settlement' table DATA "location from (SELECT sp.settlement_part_id, sp.name as settlementname, sp.location, lr.loss_unit as unit, lr.value as val FROM (settlement_part sp left join loss_result lr on (sp.settlement_part_id=lr.item_id and lr.item_type='settlement_part') ) left join loss_model lm on lm.model_id=lr.model_id WHERE lr.model_id in (SELECT l.model_id FROM loss_model l WHERE l.calculation_session_id=22) and lr.loss_unit='patients (mean)' ) as set_calc using unique settlement_part_id using SRID=4326 " |
Code:
sed -e 's/Event 22/Event 23/; s/id-22/id=23/' Event22.txt > Event23.txt Code:
sed -e 's/22/23/g' Event22.txt > Event23.txt |
Thanks for the help!
Thanks for the help!
Is there a way to have this script run as a result of a click event on a webpage? In addition, can the number ‘23’ be ‘24’ for the next click event and ’25’ for the next and so on? |
Quote:
Code:
#!/bin/bash As an aside, what exactly are you trying to accomplish? If the Event files are served up as web content, you might serve them dynamically instead of making almost-identical copies on your server’s disk. |
cool tool too, in the debian repositories:
Code:
rpl |
Quote:
|
All times are GMT -5. The time now is 06:16 AM. |