Adding random CSV creation script
Browse files
etl.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Description: Used to generate Random CSV data
|
| 4 |
+
# Author : Ranga Reddy
|
| 5 |
+
# Version : v1.0
|
| 6 |
+
# Date : 18-Sep-2022
|
| 7 |
+
|
| 8 |
+
num_records=${num_records:-20} ## Number of Records
|
| 9 |
+
salary_max_rand_val=2000 ## Maximum Salary Range value
|
| 10 |
+
name_prefix=${name_prefix:-"ranga"} ## Name Prefix
|
| 11 |
+
csv_file_name=data.csv ## CSV filename
|
| 12 |
+
|
| 13 |
+
echo "ID NAME AGE SALARY" | awk '{print $1,"\t",$2,"\t",$3,"\t",$4}' > $csv_file_name
|
| 14 |
+
|
| 15 |
+
seq -f "%.0f" $num_records | awk -F $'\t' -v SAL_RAND_VAL=$salary_max_rand_val -v NAME_PRE=$name_prefix '{print $1,"\t",NAME_PRE$1 FS int(100*rand()) FS int(SAL_RAND_VAL*rand())}' >> $csv_file_name
|