awk File pattern

cat FILE | awk ORS="\n" -F"|" '{if ($3/$5 % 10 != 0)  {print $0} }' | awk 'BEGIN { ORS="\n" } -F"|" {print $1,$2,$3,$4,$5}' > FILE

The records in FILE are like this
ABC| ABC OPT 23 | 100.000000000000000 | ABC OP 10 | 134.00000000

I need them to be like
ABC,ABC OPT 23|100.0000000|ABC

Hi,

Try this

cat file | awk -F"|" '
{

print $1","$2"|", substr($3,1,11)"|"substr ($4,1,4)

}' > file1

Cheers,
Vijay.

(g)awk -F"|" '{split($4,a," "); printf "%s,%s|%.7f|%s" ,$1,$2,$3,a[1]}' file

It shows
ABC,ABC ABC | |

which is not expected the spacing in second and 3rd column is not consistent.

Try this (not tested), presuming you output sample was just the start of the output format:

awk ORS="\n" -F"|" '{if ($3/$5 % 10 != 0)  {printf "%s,%s|%.7f|%s|%s\n",$1,$2,$3,$4,$5}' infile > outfile

awk: cmd. line:1: ORS=\n
awk: cmd. line:1: ^ backslash not last character on line

awk '{....................}' ORS="\n" file
awk 'BEGIN{ORS="\n"}........' file

bash-3.00$ awk 'BEGIN{ORS="\n"} -F"|" '{if ($3/$5 % 10 != 0) {printf "%s,%s|%.7f|%s|%s\n",$1,$2,$3,$4,$5}'
bash: syntax error near unexpected token `('

And this:

awk -F"|" '{if ($3/$5 % 10 != 0)  {printf "%s,%s|%.7f|%s|%s\n",$1,$2,$3,$4,$5}}' infile > outfile

It does not produces line break after each line

US, dfdsfCL ABX DEC 49.0 BA GOLD CRP|49.0000000| C A DEC 09 48.0 BCK GO CORP| 48.00000000
US, PU 09 49.0 BAK GOLD CORP|49.0000000| T A DEC 09 47.0 BAK GOLD CP| 47.00000000

---------- Post updated at 02:04 PM ---------- Previous update was at 01:58 PM ----------

Also after first word there is , but | after others

---------- Post updated at 02:12 PM ---------- Previous update was at 02:04 PM ----------

Let me explain this properly

ABC|ABC IPO AOP |49.000|ABC IPO AOP|4900.0000
ABC|ABC IOPO AOP |49.000|ABC IOPO AOP|4900.0000

Now I need 5th column to be divided by col 3 and run a modulus $3/$5 % 10 != 0 and then create the file in a with a comma seperated
like this

ABC,ABC IPO AOP ,49.000,ABC IPO AOP,4900.0000

awk -F"|" 'BEGIN{ ORS="\n"  && print "I should read the doc first" }' file

Can someone help can go through the doc later