I am trying to paste two cuts in bash, but it throwing an error Syntax error: "(" unexpected when i am trying to run in loop. however the same code is working on a single file. Can anyone please help me.
this is working
paste -d, <(cut -d, -f -2 IE3BW0047A_03012017000949.csv) <(rev IE3BW0047A_03012017000949.csv | cut -d, -f -7 | rev)
but execution in loop is not working
for filename in *.csv; do
paste -d , < (cut -d, -f -2 "$filename") < (rev "$filename" | cut -d, -f -7 | rev) > ${tgt_wd}/"$filename"
done
sh, POSIX shell does not recognize process substitutions. Even your/bin/shis link tobash, it will parse<(...)as an incorrect input redirection, to maintain POSIX compatibility.