I am new with Lunix, I tried to write a function, which takes 3 parameters input data, output data, and selected column
The function: read the input data, write and remove duplicated row for the selected column and save it output data.
If I do on command like that, it worked
cat new_trans.txt | awk -F',' '\!seen[$1]++ { print $1}' > test
bash ./shell_fn.sh testA new_trans.txt test_new_trans.txt $1
testA() {
col = $3
cat $1 | awk -F',' '\!seen[\$$col]++ { print \$$col}' > $2
cat $2 | head
}
"$@"