bmk123
1
Hi Team,
we have one oracle function return like this and assign to value like this.
col_list={print $64,$64,$52,$64,$64,$33}
tail -n +"${record_pstn}" "${file_name}" |/usr/bin/awk -f <( echo "${col_list}" ) FS="${ifs}" OFS="${ofs}"
while running the script using ./test.sh it working fine.
suppose we run like sh test.sh and it is raising the below error.
Error :syntax error near unexpected token `('
please help me.
<( list )
(process substitution) not available is sh, your first example was probably using bash to run the script.
You could try this instead:
col_list='{print $64,$64,$52,$64,$64,$33}'
tail -n +"${record_pstn}" "${file_name}" | /usr/bin/awk "$col_list" FS="${ifs}" OFS="${ofs}"
Or roll the tail command into awk like this:
col_list='{print $64,$64,$52,$64,$64,$33}'
/usr/bin/awk "FNR >= ${record_pstn} $col_list" FS="${ifs}" OFS="${ofs}" "${file_name}"
2 Likes
bmk123
3
i used the first solution and it working fine.
Thanks a lot.