2012年5月28日 星期一

[bash script][sed] sed replace long string method


#!/bin/bash



# echo "input ' Wireless Cable Router ' to XXXX language"

# read input # read character input

# sed 's|||g'  -i ../no_change/$CounrtyName/$FileName



FileName='RgBasicInternet.htm'

CounrtyName='Czech'





Wireless_Cable_Router_Configuration_BASIC_INTERNET='BASIC - INTERNET'





Internet='internetového'

Local_Area_Network='Local Area Network'

DHCP_Client_Devices='DHCP Client Devices'





BASIC='Základní'





# if string include ' then become a variable will be passed

This_page_allow_configuration_of_the_basic_features_of_the_broadband_gateway_related_to_your_ISPs_connection_original="This page allow configuration of the basic features of the broadband gateway related to your ISP's connection"





This_page_allow_configuration_of_the_basic_features_of_the_broadband_gateway_related_to_your_ISPs_connection="This page allow configuration of the basic features of the broadband gateway related to your ISP's connection"



 



# -i mean which file



 



#'  "   "  ' (actually this is combine together) this will resolve long string   -->  'BASIC - INTERNET'

# If not use this method can't display long string, bash script will error.




sed 's|<title>BASIC - INTERNET</title>|<title>'"$Wireless_Cable_Router_Configuration_BASIC_INTERNET"'</title>|g'  -i ../no_change/$CounrtyName/$FileName















sed 's|<p>'"$This_page_allow_configuration_of_the_basic_features_of_the_broadband_gateway_related_to_your_ISPs_connection_original"'.</p>|<p>'"$This_page_allow_configuration_of_the_basic_features_of_the_broadband_gateway_related_to_your_ISPs_connection"'.</p>|g'  -i ../no_change/$CounrtyName/$FileName















 

Related Posts:

0 意見:

張貼留言