15 lines
		
	
	
		
			504 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			504 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/sh
 | 
						|
file="$1"
 | 
						|
oed_app_id="$(pass show GRE/oxforddictionary_api | grep -E '^app_id' | cut -d' ' -f2)"
 | 
						|
oed_app_key="$(pass show GRE/oxforddictionary_api | grep -E '^app_key' | cut -d' ' -f2)"
 | 
						|
 | 
						|
while read -r line
 | 
						|
do
 | 
						|
	echo "word: $word"
 | 
						|
	no="$(echo "$line" | cut -f1)"
 | 
						|
	word="$(echo "$line" | cut -f2)"
 | 
						|
	json="$(./oed_get_json "$word" "$oed_app_id" "$oed_app_key"
 | 
						|
		tr -d '\n')" # done since newlines can malform json data if appearing mid-string
 | 
						|
	echo "$json" > json/"$no"_"$word".json
 | 
						|
done < "$file"
 |