hi guys, your help and ideas is greatly appreciated.
just for update to anyone who might need it, the code below did not show any output redirection error despite of the data inside the csv whether it has slashes, colon and other special characters
Quote:
#!/bin/bash
input="/home/hrts/Documents/p/inputx.txt"
dfile="/home/hrts/Documents/Athena-Book2.csv"
while read -r line
do
#echo "$line"
#xx="awk -F',' '/$line/' $dfile > $line".txt""
#echo "$xx"
awk -F',' "/$line/" $dfile > $line".txt"
done < "$input"
#i-0a3f - is the pattern from input.txt
#awk -F',' '/i-0a3f/' book2.csv > i-0a3f.txt <--this would be the exact command that is executed after substituting the variable
|
The CSV has 330 unique patterns if i put everything the text file has no output, I have to break it into 30 chunks. Never tried by 50 or 100 but anyway script above works. Thanks everyone. Cheers!
Let's enjoy scripting and always be safe, stay at 127.0.0.1.