shell - How to create multiple scripts with name and content following a pattern -


i have file containing text, eg: text.txt:

value1 value2 value3 value4 

and want make script creates file name format name_of_file_value1_python.py contains following lines:

#!/usr/bin/python2.6  url = "http://example.com/abc/get?value=value1" print "count.value1",data['total'] 

while read i; printf '#!/usr/bin/python2.6\n\nurl = "http://example.com/abc/get?value='$i'"\nprint "count.'$i'",data["total"]' > name_of_file_${i}_python.py; done < text.txt 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -