The magic of CLI

You want to turn something like this:
[bash]
chartsales_messages_es.properties
chartsales_messages.properties
closedpos_messages_es.properties
closedpos_messages.properties
closedproducts_messages_es.properties
closedproducts_messages.properties
customersdiary_messages_es.properties
customersdiary_messages.properties
customers_messages_es.properties
customers_messages.properties
inventoryb_messages_es.properties
inventoryb_messages.properties
inventorydiff_messages_es.properties
inventorydiff_messages.properties
inventory_messages_es.properties
inventory_messages.properties
people_messages_es.properties
people_messages.properties
productlabels_messages_es.properties
productlabels_messages.properties
productsales_messages_es.properties
productsales_messages.properties
productscatalog_messages_es.properties
productscatalog_messages.properties
products_messages_es.properties
products_messages.properties
taxes_messages_es.properties
taxes_messages.properties
usersales_messages_es.properties
usersales_messages.properties
[/bash]

into this:

[bash]
chartsales_messages.properties
chartsales_messages.properties
closedpos_messages.properties
closedpos_messages.properties
closedproducts_messages.properties
closedproducts_messages.properties
customersdiary_messages.properties
customersdiary_messages.properties
customers_messages.properties
customers_messages.properties
inventoryb_messages.properties
inventoryb_messages.properties
inventorydiff_messages.properties
inventorydiff_messages.properties
inventory_messages.properties
inventory_messages.properties
people_messages.properties
people_messages.properties
productlabels_messages.properties
productlabels_messages.properties
productsales_messages.properties
productsales_messages.properties
productscatalog_messages.properties
productscatalog_messages.properties
products_messages.properties
products_messages.properties
taxes_messages.properties
taxes_messages.properties
usersales_messages.properties
usersales_messages.properties
[/bash]

I can’t imagine an easy way to do it with Windows but with bash and any Unix like OS, you get it done in less than a minute.

[bash]
for line in $(ls *.properties)
do
mv $line `echo $line | sed “s/_es.properties/.properties/”`
done;
[/bash]

One thought on “The magic of CLI”

Comments are closed.