On branch parse-mdls
Your branch is up to date with 'origin/parse-mdls'. Changes to be committed: modified: hash-files Write csv columns to csv file.
This commit is contained in:
		
							parent
							
								
									fe2d738b42
								
							
						
					
					
						commit
						e012a9b50f
					
				
							
								
								
									
										20
									
								
								hash-files
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								hash-files
									
									
									
									
									
								
							@ -63,11 +63,6 @@ hash_files () {
 | 
				
			|||||||
create_csv () {
 | 
					create_csv () {
 | 
				
			||||||
#echo "=== Create array of comma-separated-values. ===
 | 
					#echo "=== Create array of comma-separated-values. ===
 | 
				
			||||||
#=================================================="
 | 
					#=================================================="
 | 
				
			||||||
	csv_columns=( "File Path" "File Hash" )
 | 
					 | 
				
			||||||
	for key in ${keys_of_interest[@]};do
 | 
					 | 
				
			||||||
		csv_columns+=( ${keys_of_interest[key]} )
 | 
					 | 
				
			||||||
	done
 | 
					 | 
				
			||||||
	IFS=',';echo "${csv_columns[*]}";IFS=$'\n'
 | 
					 | 
				
			||||||
#	for i in ${!list_of_files[@]}; do
 | 
					#	for i in ${!list_of_files[@]}; do
 | 
				
			||||||
#		csv_array+=( ${list_of_files[i]},${list_of_hashes[i]} )
 | 
					#		csv_array+=( ${list_of_files[i]},${list_of_hashes[i]} )
 | 
				
			||||||
#	done
 | 
					#	done
 | 
				
			||||||
@ -78,10 +73,19 @@ create_csv () {
 | 
				
			|||||||
write_data () {
 | 
					write_data () {
 | 
				
			||||||
#echo "=== Write data to a .csv file. ===
 | 
					#echo "=== Write data to a .csv file. ===
 | 
				
			||||||
#===================================="
 | 
					#===================================="
 | 
				
			||||||
 | 
						## Create temp file
 | 
				
			||||||
	temp_csv_file=$($mktemp_bin)
 | 
						temp_csv_file=$($mktemp_bin)
 | 
				
			||||||
	printf '%s,%s\n' "File Path" "File Hash" >> $temp_csv_file
 | 
						## Initialize column names
 | 
				
			||||||
	for line in ${csv_array[@]};do
 | 
						csv_columns=( "File Path" "File Hash" )
 | 
				
			||||||
		printf '%s\n' $line
 | 
						## Populate Columns from keys of interest
 | 
				
			||||||
 | 
						for key in ${keys_of_interest[@]};do
 | 
				
			||||||
 | 
							csv_columns+=( ${keys_of_interest[key]} )
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
						## Print columns to first line of csv
 | 
				
			||||||
 | 
						IFS=',';echo "${csv_columns[*]}";IFS=$'\n' >> $temp_csv_file
 | 
				
			||||||
 | 
						## Print csv array rows following columns row
 | 
				
			||||||
 | 
						for row in ${csv_array[@]};do
 | 
				
			||||||
 | 
							printf '%s\n' $row
 | 
				
			||||||
	done >> $temp_csv_file
 | 
						done >> $temp_csv_file
 | 
				
			||||||
#	cat $temp_csv_file
 | 
					#	cat $temp_csv_file
 | 
				
			||||||
	write_log "$temp_csv_file written successfully."
 | 
						write_log "$temp_csv_file written successfully."
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user